Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

write a c++ program that will calculate and print bills for city water utilities

ID: 3646436 • Letter: W

Question

write a c++ program that will calculate and print bills for city water utilities. Water rates vary depending on the size of the meter and water usage. Any size meter other than what is listed should be treated as a error. Your program should use a while loop with a priming read. The loop should terminate when the account number is 000. Prompt the user to enter the account number (a string) and the meter size.
Meter Size = 0.625 or 0.75 or 1.0
The output should include the account number, the number of gallons used, the cost of the water, the Sanitation fee, the Storm water fee and the total amount of the bill.

I am so confused...This is what I have so far:


#include <iostream>
#include <conio>
#include <string>
#include <iomanip>
#include <cassert>


using namespace std;

double FindBaseWaterChrg(double);
double FindRatePerGallon(int,double);
double FindWaterCost(double,double);
double FindTotalCost(int,double,const double,const double);

const double SANITATION_FEE = 20.41; //declare const variable
const double STORM_WATER_FEE = 5.80; //declare const variable
const int ACCOUNT_NBR = 000;

int main()
{
//Declare Variables
int acctNbr;
int metSize; //declare meter size
int gallonsUsed; //declare # of gallons used
double meterSize; //declare Meter Size
double baseWaterChrg; //declare Base Water Charge
double ratePerGallon; //declare rate of Water per Gallon
double waterCost; //declare rate for Water Cost
double totalCost; //declare Total Cost

//Input Section
cout << "Enter your Account Number: " << endl;
cin >> acctNbr;
cout << endl;

while (acctNbr != 000)
{
cout << "WATER BILL" << endl;
cout << "Account Number: " << endl;
cin >> acctNbr;
}

//Output Section
cout << "Gallons used: " << gallonsUsed << endl;
cout << setprecision(2) << "Water cost: " << waterCost << endl;
cout << setprecision(2) << "Sanitation fee: " << SANITATION_FEE << endl;
cout << setprecision(2) << "Storm water fee: " << STORM_WATER_FEE << endl;
cout << "-----------------------" << endl;
cout << setprecision(2) << "Total Cost: " << totalCost << endl;

_getch();
return 0;
}
//Processing Section
double FindBaseWaterChrg(double meterSize)
{
double baseWaterChrg;
if (meterSize = 0.625)
baseWaterChrg = 3.61;
else if (meterSize = 0.75)
baseWaterChrg = 4.23;
else if (meterSize = 1.0)
baseWaterChrg = 6.14;
return baseWaterChrg;
}
double FindRatePerGallon(int gallonsUsed, double ratePerGallon)
{
if (gallonsUsed <= 4000)
ratePerGallon = 0.00141;
else if (gallonsUsed >= 4001 && gallonsUsed <= 10000)
ratePerGallon = 0.00231;
else if (gallonsUsed >= 10001 && gallonsUsed <= 15000)
ratePerGallon = 0.00320;
else if (gallonsUsed > 15000)
ratePerGallon = 0.00370;
return ratePerGallon;
}
double FindTotalCost(double waterCost,const double SANITATION_FEE,const double WATER_FEE,double baseWaterChrg)
//Preconditions: The values of the total water cost, sanitation fee and water fee are known
//Postconditions: The total bill is calculated and printed.
{
double totalCost;
totalCost = waterCost + SANITATION_FEE + STORM_WATER_FEE + baseWaterChrg;
return totalCost;
}
double FindWaterCost(double gallonsUsed,double ratePerGallon)
//Preconditions: The value of the rate per gallon and the gallons used is known.
//Postconditions: The water cost is calculated and printed
{
double waterCost;
waterCost = (gallonsUsed * ratePerGallon);
return waterCost;
}

Explanation / Answer

#include #include #include #include #include using namespace std; double FindBaseWaterChrg(double); double FindRatePerGallon(int,double); double FindWaterCost(double,double); double FindTotalCost(int,double,const double,const double); const double SANITATION_FEE = 20.41; //declare const variable const double STORM_WATER_FEE = 5.80; //declare const variable const int ACCOUNT_NBR = 000; int main() { //Declare Variables int acctNbr; int metSize; //declare meter size int gallonsUsed; //declare # of gallons used double meterSize; //declare Meter Size double baseWaterChrg; //declare Base Water Charge double ratePerGallon; //declare rate of Water per Gallon double waterCost; //declare rate for Water Cost double totalCost; //declare Total Cost //Input Section cout