Having trouble with this project -- Counters, pool fill

Hey guys, I'm having trouble with a few parts of this project. In particular, I'm having trouble with the gallons per hour and the fill rate. I don't even know where to begin. Also, later in the instructions, I have to use a counter which I know would probably include a "for" loop. Any help and ideas about how to go about this project would be greatly appreciated. I'll paste the entirety of the instructions below. It's long, but I hope someone can help out. Thanks in advance!


Here are the instructions to the project:

"Write a program to show the increase in water depth for a swimming pool that is 20' x 40' [20 feet x 40 feet]. Assume that the pool is 6' deep in all places and you need to fill the pool to within 6" (6 inches) of the top. Hence, the pool is 6' deep, 20' wide and 40' long but you must stop the water before it gets within 6” of the top. You are anticipating a fun-filled spring and summer so you must fill the pool with your garden hoses.
Here are the details for your calculations and assumptions:
1) The pool fills at no less than 0.5" per hour and no more than 2.25” per hour, the fill-rate. Hence, you’ll need to ask the user for the input of the amount per hour. Allow up to 2 decimals and not more than 2.25” per hour.
a. Compute the gallons per hour and fill-rate into the pool. You will need to calculate the volume of the pool and the gallons in that volume per hour. See the Internet!
2) You need to determine the gallons the pool has after EACH 2” [Note: was ‘hour’] until the pool is full. [Note: 2” per hour fill-rate is easy but you’ll need to calculate the fill-rate when the fill-rate is NOT 2” per hour. The fill-rate is a variable – user-entered.] Display your results as SETs of output of twenty (20) per display page in increments of 2” displays (cout). The user MUST select Y or y for continuation until the next 20. Make sure you terminate the output once completed. That is, don't repeat the last line and don't print blank lines once you've reached the final calculation.
a. Display Counter, Time, Time, Water Depth, Gallons, Weight
i. Format:
1. Counter: nn [This is a counter which is an associated counter = the row’s output. That is, what row is this for THIS output. You’ll need to reset this to 1 when you display a new screen for data.
2. Time [Hours]: hours.decimal [hh.nnn] 3 decimals
3. Time [Hours]: Standard hours & minutes format of hh.mm.ss.nnn [3 decimals]
4. Water depth: feet.decimal [nn.nnnn] 4 decimals associated with the current Counter and Time.
5. Gallons: [nnnnn.nnnnn] 5 decimals; in pool associated with the current Counter and Time
6. Weight: What is the WEIGHT of the water in the pool? [Note: you will need to convert the volume of the water to weight.]
3) Save the program as a Notepad program with the format of
a. CSCI155 Lastname, Firstname Project 1 – Pool Fill Project.txt
4) Use C++ you’ve learned through Chapter 5.

Some hints and observations:
a) Each output line is to be every 2” so the Time calculations are based upon how long it takes to fill 2” of volume at the user-entered fill-rate. You’ll need to validate what happens when the user-enters 1.25” per hour and then you display every 2”. You’ll need to convert the time to fill 2” at 1.25” per hour to hh:mm:ss.nnn format and the hh.nnn format.
b) Water depth is to be converted to feet with associated decimals.
"
So far, I only have some variables written.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
  // Pool Fill Project

#include "stdafx.h"
#include <iostream>
#include <cmath>
#include <string>
#include <iomanip>
using namespace std;


int main()
{
	// Variables
	double fill_rate;			// More than 0.5"/hr, no more than 2.25"/hr
	double poolLenth = 40.0;
	double poolWidth = 20.0;
	double poolDepth = 6.0;
	double totalVolume = (poolDepth * poolLenth * poolWidth);
	int counter;

	 

	


	system("Pause");
    return 0;
}
Last edited on
Write a function to prompt for the fill rate in inchesPerHour. If the entered value is less than 0.5 or greater than 2.25 then print an error message and prompt again.

Sit down and do some math:
- If you know the fill rate in inches/hour, then how long does it take to get 2" in the pool? This is the time interval at which you must print a line of output.
- Given the fill rate in inches per hour, what the rate in gallons per hour?
- Give the gallons/hour rate, how many gallons are in the pool at time T?
- Give a number of gallons, what is weight?

I'd work out these formulas first. Then create code to compute them. Get the output numbers and make sure they are correct. DO NOT worry about the formatting at this point. You may want to double check by creating a spreadsheet that does basically the same thing.

Once you're sure that the numbers are right, format the output in the manner given.
Topic archived. No new replies allowed.