Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Project 1 Utility Billing Objective: To gain experience with input/output statements, calculations and flow control structures. Description: 1. The program will compute and display information

Project 1 Utility Billing Objective: To gain experience with input/output statements, calculations and flow control structures. Description: 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 will prompt the user to enter three values (in the following order): a. The customer's code (a character) b. The customer's beginning meter reading (a positive integer value) c. The customer's ending meter reading (a positive integer value) It will then process that customer information and display the results. The program will continue to process customers until the user enters an invalid customer code. 3. The program will compute the gallons of water used by the customer during the current billing period. The meter is read 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. Code 'r' (residential): $5.00 plus $0.0005 per gallon used Code 'c' (commercial): $1000.00 for 4 million gallons or less, and $0.00025 for each additional gallon used Code 'i' (industrial): $1000.00 if usage does not exceed 4 million gallons; $2000.00 if usage exceeds 4 million gallons but does not exceed 10 million gallons; and $2000.00 plus $0.00025 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. Assignment Details 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 meters 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 program is not required to check the user-supplied meter readings for errors. That is, you may assume that the user always enters valid meter readings (integer values between 0 and 999999999). 4. 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). Commentary To clarify the project specifications, weve provided sample output at the end of this document. Be sure to prompt the user for the three inputs in the correct order. And, your program cannot prompt the user for any other inputs. To grade your program, your TA will enter a series of inputs and it will be the same series of inputs for each students program. It isnt necessary for the user to type leading zeroes when entering meter readings. Similarly, it isnt necessary for the program to print leading zeroes when displaying meter readings. Project Requirements: You must follow all of the good programming practices discussed in class: Comment your code thoroughly. Indent your code appropriately. Use meaningful variable names. Provide the user with understandable prompts and instructions. Make sure your name is included in comments at the top of your code. If this is not done, points will be deducted from your program and it will be impossible to earn an A. Sample Output Extra Credit (1 to 5 points): Your program is only required to meet the specifications given above. However, there are several optional extensions to the project that you should consider adding to your program: 1. Recognize upper case letters for customer codes (R, C and I). 2. Display all meter readings as nine-digit numbers (with leading zeroes). 3. Check for invalid user-supplied meter readings. Robust programs should detect, report and recover from invalid user inputs. That is, a robust program will check user-supplied inputs to determine if they are valid or not, will report any problems to the user, and will take the appropriate steps to continue with execution. A robust version of this program would detect invalid meter readings (values outside the range 0 to 999999999), report them to the user, and allow the user to continue with the next customer. Please note that the user should always enter three items (code and two meter readings), even if the first meter reading is invalid.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Management With Website Development Applications

Authors: Greg Riccardi

1st Edition

0201743876, 978-0201743876

More Books

Students also viewed these Databases questions