Write a program that calculates and prints out bills of the city water company.
ID: 3651708 • Letter: W
Question
Write a program that calculates and prints out bills of the city water company. The water rates vary, depending on 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 h: $5.00 plus $0.0005 per gallon used
*code c: $1000.00 for the first 4 million gallons used and $0.00025 for
each additional gallons.
*code 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.00 if usage exceed 10 million gallons.
Your program should prompt the user to enter an account number (type
int,),the code (type char),and the gallons of a water used ( type float).
Your program should echo the input data and print the amount due
from the user.
I'm triying to do thisp rogram someone can fixsmy errors:
#include <iostream>;
#include <cmath>
using namespace std;
int main()
{
int account;
char code;
double gallons, bill;
cout << "Enter your account number:" << endl;
cin >> account;
cout << "Now enter your code(h,c, or i):" << endl;
cin >> code;
cout << "Now enter the amount of gallons of water used:" << endl;
cin >> gallons;
if (code == 'h')
{
bill = 5 + (gallons * 0.0005);
}
if (code == 'c') && (gallons > 4000000)
{
bill = 1000 + ((gallons - 4000000) * 0.00025);
}
else if (code == 'c') && (gallons <= 4000000)
{
bill = 1000;
}
if (code == 'i') && (gallons <= 4000000)
{
bill = 1000;
}
else if (code == 'i') && (gallons < 4000000); && (gallons !> 10000000)
{
bill = 2000;
}
else if (code == 'i') && (gallons >= 10000000)
{
bill = 3000;
}
cout << "The bill for account number: " << account << ", will be: $" << bill << endl;
return 0;
}
Explanation / Answer
#include ; #include using namespace std; int main() { int account; char code; double gallons, bill; 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.