Scientific Programming Homework Assignment 3 Program Design and Coding II due Fe
ID: 3669093 • Letter: S
Question
Scientific Programming
Homework Assignment 3 Program Design and Coding II
due February 18
Grading: design 1 point
C++ program 2 points
testing, including test data 1 point .5 p3 points for correct program
this may be a group assignment …no more than 2 programmers to a group.
Running the faucet while you are brushing your teeth can waste a lot of water. You will design, code and test a program to determine just how much water you actually waste. The program will input the amount of time spent brushing teeth per day. It will print the amount of water wasted in gallons and in liters. (1 gallon = 3.78 liters), for one brushing. It will also print the amount of water wasted in a week, and in a year.
The normal flow of water through a faucet is approximately 2.2 gallons per minute*. You can use this amount for water flow or get a more accurate measure for your own home and use that.
submit design, source code and copy of the output window
fill out sheet on the next page to submit
*if you want a more accurate measurement put a container under the faucet and run water for 10 seconds. Measure the amount in the container and multiply by 6 to get the number of gallons per minute.
Homework Assignment 3 How much water do I waste?
Programmers _______________________________________________
_______________________________________________
Design:
Output: insert here
Input: insert here
Processing steps, pseudo code or flowchart:
insert here
Source code: paste a copy of your source code here
test data: Insert your test data here (various times and expected output)
output: Insert at least two copies of your output screen here:
(note: you can use the clipping tool to copy the output screen and paste
directly in this document; also ALT+PrtScr works to do same)
To take a screenshot of only one window
Tap or click the window you want to capture.
Press Alt+PrtScn. A picture of the window is copied and you can paste it wherever you'd like.
Explanation / Answer
#include <iostream>
using namespace std;
int main() {
// your code goes here
int op;
float min,rate=2.2;
double dg,wg,yg,dl,wl,yl;
cout<<"amount of time spent brushing teeth per day";
cin>>min;
cout<<" do you want to enter flow rate (1: yes)?";
cin>>op;
if(op == 1)
cin>>rate;
dg = rate * min;
wg = dg*7;
yg = dg * 365;
dl = dg *3.78;
wl = wg *3.78;
yl = yg *3.78;
cout<<" The amount of water wasted in a week is "<<wg<<" gallons and "<<wl<<" in litres";
cout<<" The amount of water wasted in a week is "<<yg<<" gallons and "<<yl<<" in litres";
return 0;
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.