Sale!

CPSC121 Assignment 3 – Utility Calculator

$30.00 $18.00

Category: You will Instantly receive a download link for .zip solution file upon Payment || To Order Original Work Click Custom Order?

Description

5/5 - (1 vote)

You will implement a program that calculates the water bill for a customer based on their water meter
reading.
1. The program will compute and display information for a utility company which supplies water to
its customers. For a specified customer, the program will compute and display the amount of
money which the customer will be billed for water usage during the current billing period.
2. The program prompts the user for three inputs (in the following order):
a. The customer’s beginning meter reading (a positive integer value)
b. The customer’s ending meter reading (a positive integer value)
c. The customer’s code (a character)
3. The program will compute the gallons of water used by the customer during the current billing
period.
The meter is read by a representative of the utility company at the start and at the end of the
billing period, and the readings are taken from a meter which has nine digits and records
tenths of a gallon.
4. The program will compute the amount of money that the customer will be billed, based on the
customer’s code and water usage, using the following information. NOTE: you must handle
both lower and uppercase letters for the code.
Code ‘r’ (residential):
• $15.00 base fee plus $0.0005 per gallon used
Code ‘c’ (commercial):
• $1000.00 base fee plus $0.00002 for each gallon used
Code ‘i’ (industrial):
• $1000.00 base fee if usage does not exceed 4 million gallons plus $0.00002 for each
gallon used;
• $2000.00 base fee if usage exceeds 4 million gallons but does not exceed 10 million
gallons plus $0.00001 for each gallon used;
• $2500.00 base fee plus $0.0025 for each additional gallon if usage exceeds 10 million
gallons.
5. For each customer, the program will display a summary with the following information:
a. The customer’s code
b. The customer’s beginning meter reading
c. The customer’s ending meter reading
d. The gallons of water used by the customer
e. The amount of money billed to the customer
All output will be appropriately labeled and formatted.
NOTES
1. As stated above, the meter’s dial has nine digits and records tenths of a gallon. For example,
assuming that the beginning reading was 444400003 and the ending reading was 444400135,
then the customer used 13.2 gallons of water during the billing period.
2. Since the meter’s dial only has nine digits, the reading at the end of the billing period may be
less than the reading at the beginning of the billing period. For example, assuming that the
beginning reading was 999999997 and the ending reading was 000000005, then the customer
used 0.8 gallons of water during the billing period.
3. The amount of money billed to a customer should be displayed as a monetary value. That is, it
should be displayed with a dollar sign and two fractional digits (for example, $125.00 or
$43.87). Use cout formatting to show only two decimal places.
4. I have provided variable declarations. You must use my variables for input. You can declare
additional variables as needed.
5. Provide at least 9 runs of your program – ensure you are testing all cases including edge
cases.
What to turn in:
A single zip file named: “lastname_firstname_assignment3.zip”
-Inside the zip file has a single folder named “assignment3”
-inside this folder contains:
-your UtilityCalculator.cpp file
-a “results.txt” file that has your copy-pasted output from 9 runs of your program.
-the provided Makefile
Do not modify the Makefile, it is used for your convenience. To run your code, navigate to the
directory inside terminal and type “make”
Do not change the names of the folder, the .cpp file, or the Makefile.
Rubric:
Program Compiles without warnings or errors 10 points
(Non-compiling code will receive 0 points)
Files and Folders named correctly, including the
.zip
5 points
Program runs and produces correct outputs 25 points
results.txt file contains 9 test runs, showcasing
edge cases are handled correctly
5 points
Proper naming conventions and comments 5 points