Counter Help -- Difficulties Understanding Instructions

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.]"
Wow, teacher's like these should be punched in the face for their absolute horrid explanations. What is the Computer Science curriculum coming to? Aside from my irrelevant rant, perhaps he is talking about setw(20)? I'm not really sure, it's quite incoherent to me. Surely someone else will be able to decipher what he wants though.
I completely agree with you. I've been trying to decipher this for days. I LOVE being a Computer Science major but this professor is awful. I can't understand what he wants in most of the assignments we do. We've been learning about "while" and "for" loops recently so I was thinking maybe that's what he wants us to do in some way or another.
Is this like a intro to programming class? Is there a way you can post a link or pdf of the actual assignment so I can take a look at it?
Yeah, it's an introductory course. I'll paste the entire assignment below. I'd give you a link but it's a Word document.

"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” 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."
If you can decipher that, I'll really appreciate your input.
What is 2" supposed to mean? 2 inches?
Yeah, 2 inches. " for inches and ' for feet
I feel like I have part one of the instructions down pretty well but he completely lost me on part two.
This is what this douche bag professor says:

"Display your results as SETs of output of twenty (20) per display page in increments of 2” displays (cout)."

Which I am interpreting to:

1) Output your results with a width of 20 separated by two inches

In this case I think you will have to use setw() http://www.c4learn.com/cplusplus/cpp-setw-setting-field-width/

Maybe he wants:

1
2
3
 
cout << setw(20);
cout << "Result 1: 500 feet something inches " << endl;


I'm just guessing. No clue really.
Last edited on
We haven't covered that in class and we're supposed to use information that we've covered so I'm at a loss. I'm just going to have to wing the counter that he wants. I don't really get what he wants with the "time" portion stated in the second part of the instructions. I do really appreciate you trying to decipher this with me.
Topic archived. No new replies allowed.