Computers and Technology

Write a program to create two types of utility bills: water bill and electricity bill. Both types of bills have customer’s name and address. They calculate charge differently. Your project must follow these requirements. (a) Create a Utility_bill class. This class has two protected instance variables: name and address. The __init__ method takes customer’s name and address as two arguments and stores them in the instance variables. Add another protected instance variable total and initialized it to 0. Define two abstract methods calculate_charge and display_bill. These abstract methods have no real code. There is only one statement to raise a NotImplementedError exception.
(b) Create a Water_bill class. This class is a derived class of the Utility_bill class. It has an additional protected instance variable to store number of gallons of water used. Define a calculate_charge method, which asks the user to enter number of gallons of water used and uses it to calculate total charge. Customers pay $0.005 per gallon for the first 6000 gallons, and $0.007 per gallon after the first 6000 gallons. Define a display_bill method to display customer’s name, address, number of gallons of water used and total charge.
(c) Create a Electricity_bill class. This class is a derived class of the Utility_bill class. It has an additional protected instance variable to store kilowatt hours used. Define a calculate_charge method, which asks the user to enter kilowatt hours used and uses it to calculate total charge. Customers pay $0.12 per kWh for the first 500 kWh, and $0.15 per kwh after the first 500 kWh. Define a display_bill method to display customer’s name, address, number of kWh used and total charge.
(d) In the main module, ask user to enter name and address. Ask the user to choose either water bill or electricity bill. Create an object and call its calculate_charge method to calculate total charge. Call the display_bill method to display the bill.

answer
Answers: 3

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 21:30, elsauceomotho
Im doing this last minute and literally none of my neighbors or people that my dad works with use excel so if anyone could me make up an example
Answers: 1
image
Computers and Technology, 23.06.2019 11:30, magicalpenguin48
In cell h5 enter a formula that will calculate the percentage of attendees that went to the altamonte springs job fair in 2018.
Answers: 1
image
Computers and Technology, 23.06.2019 14:30, officialrogerfp3gf2s
Select the correct answer. a company wants to use online methods to target more customers. it decides to conduct a market research by collecting the data of a few customers with their consent. they want to track data of the sites that their customers frequently visit. which software can the company? a. spyware b. bots c. adware d. trojan horse e. rootkits
Answers: 1
image
Computers and Technology, 23.06.2019 15:00, med69
Barbara is interested in pursuing a career in the science and math pathway. which qualifications will her reach that goal? a. an advanced knowledge of physics and math b. an advanced knowledge of engineering and math c. an advanced knowledge of physics and robotics an d. advanced knowledge of machinery and math
Answers: 2
Do you know the correct answer?
Write a program to create two types of utility bills: water bill and electricity bill. Both types of...

Questions in other subjects:

Konu
Engineering, 24.09.2020 21:01
Konu
Mathematics, 24.09.2020 21:01