Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Code in Python Please use simple code (like the last picture) this is an example of how it should look like (simple and basic, beginner

Code in Python
Please use simple code (like the last picture)
image text in transcribed
image text in transcribed
image text in transcribed
this is an example of how it should look like (simple and basic, beginner level)
image text in transcribed
The reason why I didn't use that code was because it gave me wrong outputs.
CSULB CECS174 Project2 Water Utility Company Objectives: This assignment focuses on the design, implementation and testing of a Python program which uses control structures to solve the problem described below. No repetition, simple selection only Assignment Specifications 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. 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 biling 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' (residential): $5.00 plus 50.0005 per gallon used Code 'd' (commercial): $1000.00 for 4 million gallons or less, and so.00025 for each additional gallon used Code 'T' (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 50.00025 for each additional gallon if usage exceeds 10 million gallons. 5. For each run, the program will display a summary with the following information: a. The customer's code b. The customer's beginning meter reading The customer's ending meter reading d. The gallons of water used by the customer e. The amount of money billed to the customer 6. validation and extra requirements: a Recognize upper case letters for customer codes ("R". "C" and ""). b. Display all meter readings as nine-digit numbers (with leading zeroes). hint: observe the output of this statement. Modify and use to match the requirements print("{:0>4}" format(5)) c. The amount of money billed to a customer should be displayed as a monetary value. Meaning, it should be displayed with a dollar sign and two fractional digits (for example, $125.00 or $43.87). d. The program is required to check the customer's code and the user-supplied meter readings for errors. report these errors-only, do not ask the user to try again-invalid user inputs. Just output an invalid message with zero as the value to be outputted at the end of the code assuming we performed calculations- 1. Any letter that is not defined as a code in the problem. il values outside the range 0 to 999999999 Please Note: . 1. 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. Please note that the user should always enter three items (code and two meter readings), even if the first meter reading is invalid. Suggestions to write any code: Solve the problem using pencil and paper first. You cannot write a program until you have figured out how to solve the problem. It is fine if you discuss the paper & pencil solution with your friends, but you are to write your own Python code. Any similarities in coding both submissions will earn a zero. Use IDLE to create a new program, Write a simple version of the program-perhaps one which prompts the user for a customer code and displays it. Run the program and track down any errors. Cycle through the steps to incrementally develop your program: Edit your program to add new capabilities Run the program and fix any errors Add comments explaining your steps Do not use anything we did not leam yet. . . . Start with a small code modify modify goal until you reach your Assignment Deliverables You are to upload 2 files: 1. Your complete documented (.py) Python file 2. A word document that has a link to a video explaining your code with multiple runs. You can keep your video unlisted, but make sure it is public. And a screenshot of the output of different run that has all cases. 3. Be ready to demonstrate your code in the lab. -you will be informed by your lab instructor- Sample Output Red-input, Blue output Sample runi: Enter the customer's code: Enter the customer's beginning meter reading: 444400003 The customer's ending meter reading: 444400135 Customer code: Beginning meter reading: 444400003 Ending meter reading 444400135 Gallons of water used: 13.2 Amount billed: $5.01 Process finished with exit code 0 Sample run2: Enter the customer's code: Enter the customer's beginning meter reading: 999999997 The customer's ending meter reading 000000005 Customer code: Beginning meter reading: 999999997 Ending meter reading 000000005 Gallons of water used: 0.8 Amount billed: $1000.00 Process finished with exit code 0 Sample run 3: Enter the customer's code: Enter the customer's beginning meter reading: 999999997 The customer's ending meter reading 000000005 Customer code Beginning meter reading: 999999997 Ending metet reading 000000005 Invalid Entry Gallons of water used: 0.0 Amount billed: 50.00 Process finished with exit code o Here is the code: def water bill(); customer_type = input('Enter customer type, one from,ci). if(customer_type !=rand customer_type != 'c'and customer_type != 1): print('Error! Please try again.) else: start_reading = int(input('Enter starting meter reading: ")) end_reading = int(input('Enter ending meter reading: ") gallon_used = (end_reading - start_reading) / 10.0 if(customer_type == 'r'): print(" Customer type: Residential') bill = 5+ (0.0005 * gallon_used) elif(customer_type == 'c'); print(" Customer type: Commercial if(gallon_used 4000000 and gallon_used

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

MySQL Crash Course A Hands On Introduction To Database Development

Authors: Rick Silva

1st Edition

1718503008, 978-1718503007

More Books

Students also viewed these Databases questions

Question

Write an elaborate note on marketing environment.

Answered: 1 week ago