I'm working on a project and I'm having trouble understanding my professor's instructions. In particular, this part:
"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."
Here is my code so far:
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 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53
|
#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 poolLength = 40.0; // In feet.
double poolWidth = 20.0; // In feet.
double poolDepth = 6.0; // In feet.
double lengthInches = (poolLength * 12.0);
double widthInches = (poolWidth * 12.0);
double depthInches = (poolDepth * 12.0);
double totalFeetVolume = (poolDepth * poolLength * poolWidth);
double totalInchesVolume = (depthInches * widthInches * lengthInches);
double inGallons = (lengthInches * widthInches * fill_rate) / 231;
int counter = 0;
const string fillMessage = "What is the fill rate of your hose in inches/hr.?";
cout << fillMessage << endl;
cin >> fill_rate;
while (fill_rate < 0.5 || fill_rate > 2.25){
cout << "ERROR. Your fill rate must be between 0.5 inches and\n"
<< "2.25 inches. Please try again." << endl;
cout << fillMessage << endl;
cin >> fill_rate;
}
double fillVolume = (poolLength * poolWidth * fill_rate) / 12.0; // In cubic feet
double fillGallons = (fillVolume * 7.48); // 7.48 gallons in a cubic foot
cout << "Great! You have a fantastic hose." << endl;
cout << "Now, lets find out how many gallons of water your hose\n";
cout << "puts in your pool every hour." << endl;
cout << "Your pool is " << lengthInches << " inches long and " << widthInches << " \n";
cout << "inches wide." << endl;
cout << "You said your hose can produce " << fill_rate << " inches of water\n";
cout << "every hour. The total volume of your pool is " << totalFeetVolume << " cubic\n";
cout << "feet." << endl;
cout << "That means that your pool is gaining " << fillGallons << " gallons\n";
cout << "of water every hour." << endl;
cin.get();
return 0;
}
| |
I'm really not sure what my professor means by this or what I should do to make this happen. If it'll help, I'll post the entirety of this part of the project instructions below. Thanks in advance for any help!
"2)You need to determine the gallons the pool has after EACH 2”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.]"