C#. Calculate the water bill of a customer of Eureka Water Company given the cub
ID: 3668001 • Letter: C
Question
C#. Calculate the water bill of a customer of Eureka Water Company given the cubic feet of water used. The rate scale is as follows:
Overuse flat rate of $100
Sample input and output:
Enter the number of cubic feet of water used: 1500
Water used: 1,500 cubic feet
water charge: $41.25
-Start with the design which will include the problem specification (input, processing and output)
-The input will be from the keyboard, not assigned in the source code. (Use the Readline() method)
-The pseudocode (Hand in the paper copy in class the day the assignment is due.)
-At least three test values and the expected results (Hand in the paper copy in class the day the assignment is due.)
-A paper copy of the source code (Hand in the paper copy in class the day the assignment is due.)
Range Fee Up to and including 1000 cubic feet (cf) Initial flat rate of $15.00 Over 1000 cf, but up to and including 2000 cf Initial flat rate plus $0.0175 times amount of water used Over 2000 cf, but up to and including 3000 cf Initial flat rate plus $0.02 times amount of water used Over 3000 cfOveruse flat rate of $100
Explanation / Answer
#include <iostream>
using namespace std;
void Read(int &usage, double Charge);
void Print(double Charge);
void main ()
{
int usage;
double Charge;
int x = 0;
x = (x + 1);
Read(usage);
if(usage <= 1000)
Charge = 15.00;
else if (usage > 1000 && usage <= 2000)
Charge = 15.00 + (0.0175 * x);
else if (usage > 2000 && usage <=3000)
Charge = 15.00 + 17.50 + ( 0.02 * x);
else
Charge = 70.00;
Print(Charge);
}
void Read(int &usage, double Charge)
{
usage = 0;
cout << "Enter Water Usage: ";
cin >> usage;
}
void Print(double Charge)
{
// 1. Start
// 2. Print Output
cout << "The charge is :" << Charge << endl;
// 3. Exit
}
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.