In this exercise, you code an application that calculates a water bill. The cler
ID: 3652037 • Letter: I
Question
In this exercise, you code an application that calculates a water bill. The clerk at the water department will enter the current meter reading and the previous meter reading in two text boxes. The application should calculate and display the number of gallons of water used and the total charge for the water. The charge for water is $2.05 per 1000gallons, or .00205 per gallon. Use two independent Sub procedures: one to make the calculations and the other to display the results. Call both Sub procedures from the Calculate buttonExplanation / Answer
#include
using namespace std;
void main()//should this be int main?
{
int Amount;
double Charge;
cout << "Enter number of cubic feet ";
cin >> Amount;
cin. ignore();
if (Amount <= 1000)// I had previously inserted braces after the ) and again after 15.00;
Charge = 15.00;
else (Amount <= 2000); // I had else if here at one point and it did not work
Charge = .0175 * Amount;
if (Amount <= 3000)
Charge = .02 * Amount;
else Charge = 70.00; // There was a cin.get(); following this last else but it did not work
}
Related 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.