WATER BILLING PROBLEM The local water company has been doing their water billing
ID: 3779710 • Letter: W
Question
WATER BILLING PROBLEM
The local water company has been doing their water billing every month, by using a staff of 25 people, using calculators. Just recently, the firm’s cost accountant has informed the water company’s president that the firm could cut their workforce by 75% and improve the accuracy of their billing by putting their billing on a computer. So the president of the firm has visited your company and asked you for a demonstration of a water-billing program.
Write a Python program for a water billing company which:
1. Prints a title page with today’s date.
2. Reads from a data statement the following data values: CUSTOMER#, METER#, OLD READING, NEW READING in this order.
3. Calculates a customer’s water bill to be a service charge of $16.00 minimum charge for the first 3,000 gallons usage and $3.55/each thousand gallons used after 3,000 gallons.
4. Calculate a customer’s sewage cost of $.035/each 1,000 gallons of water used.
5. Accepts no usage > 200.
6. Has CUSTOMER = 99999, to end the program.
7. Prints CUSTOMER#, METER#, OLD READING, NEW READING and the CUSTOMER CHARGE.
8. Skips any usage which is negative (i.e. prints *** REJECTED *** for the CUSTOMER CHARGE).
9. Keeps a total of the number of customer bills processed, number of valid bills, number of invalid bills and a total amount billed to all of the customers, which is printed after the bills have been printed.
10. Only write 6 bills per page and the bills are to be formatted as illustrated.
11. Each bill starts and ends with a dashed line.
Additional Programming Notes:
1. Within each program, the student needs to use the comments to explain the purpose of each variable and to identify key parts of the program.
2. Each student will need to create their data file with a minimum of 18 customers. The filename needs to be “CustomerData.txt”. 3. The CustomerData.txt file contains each customer’s record comprising of 4 fields. Each field is separated by a blank. The last field in the record has a newline at the end.
4. Each student will need have their output be written to a file called “CustomerBilling.txt”.
5. The appropriate methods need to be created. This program needs to have the main function call the various methods to accomplish its tasks.
I am completely lost on how to do majority of this problem, it is to be written on python.
Explanation / Answer
#!/usr/bin/python
import datetime
if(file.read().CUSTOMER!=99999) #untill the CUSTOMER no is not equal to 99999
var1="WATER BILLING SYSTEM" #store the title in a varaible.
print var1.title( ) #for printing title.
print "Current date " + time.strftime("%x") # To print current date
with open("CustomerData.txt") as file: # Use file to refer to the file object
data = file.read()
do
var2=NEW READING-OLD READING #find the difference between old and new reading and stored in varaible2
if var2<=3000 : #if the value is lessthan 3000
var2=$16*3000 #bill the minimum charge of $16
print"var2"
file.write(var2)
file.close()
else #if the value is greater than 3000
var2=$16*3000+$3.55*var2 #bill the customer with a minimum of $16 and difference with 3.55 for each gallon.
print "var2"
file.write(var2)
file.close()
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.