Write a program that prompts the user for their quarterly water bill for the las
ID: 3624895 • Letter: W
Question
Write a program that prompts the user for their quarterly water billfor the last four quarters. The program should find and output their
average monthly water bill. If the average bill exceeds $75, the output
should include a message indicating that too much water is being used. If
the average bill is at least $25 but no more than $75, the output should
indicate that a typical amount of water is being used. Finally, if the
average bill is less than $25, the output should contain a message praising
the user for conserving water. Use the sample run below as a model for
your output.
Sample Run 1:
Please input your water bill for quarter 1:
300
Please input your water bill for quarter 2:
200
Please input your water bill for quarter 3:
225
Please input your water bill for quarter 4:
275
Your average monthly bill is $83.33. You are using excessive amounts of water
52 LESSON SET 4 Conditional Statements
LM_Chp4.qxd 4/24/03 12:35 PM Page 52
for a grade of D or better. Use the sample run given below to model your
Exercise 2: Add an additional switch statement that allows for a Passing option
Sample Run 2:
Please input your water bill for quarter 1:
100
Please input your water bill for quarter 2:
150
Please input your water bill for quarter 3:
75
Please input your water bill for quarter 4:
125
Your average monthly bill is $37.50. You are using a typical amount of water
Explanation / Answer
# include using namespace std; void main() { int sum=0, quarter ; float avg; coutquarter; sum=sum+quarter; coutquarter; sum=sum+quarter; coutquarter; sum=sum+quarter; coutquarter; sum=sum+quarter; avg=float(sum)/4; coutRelated Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.