Water Bill Program

 

Write a program that will calculate and print out bills for the city water company.  The water rates vary depending in whether the bill is for home use, commercial use, or industrial use.  A code of h means home use, a code of c means commercial use, and a code of i means industrial use.  Any other code should be treated as an error.  The water rates are computed as follows:

 

Code

Rate

Home (h)

$5.00 plus $0.0005 per gallon used

Commercial (c)

$1000.00 for the first 4 million gallons used and $0.00025 for each additional gallon.

Industrial (i)

$1000.00 if usage does not exceed 4 million gallons; $2000.00 if usage is more than 4 million gallons but does not exceed 10 million gallons; and $3000.000 if usage exceeds 10 million gallons.

 

Your program should prompt the user to enter an account number (assume up to 10 digits), the code, and the gallons of water used.  Your program should echo the input data and print the amount due from the user.

 

In your program, account for the fact that the user may enter H instead of h…etc.

 

After you’ve completed the program, ask the user if they would like to calculate another bill.  The user should answer Y or y if they wish to calculate another.  Set up a loop for the entire program based on this.