Question: PROBLEM 2 The energy company in Program 1 now uses different rates for residential and business customers. Residential customers pay $0.12 per kWh for the

 PROBLEM 2 The energy company in Program 1 now uses different

rates for residential and business customers. Residential customers pay $0.12 per kWh

PROBLEM 2 The energy company in Program 1 now uses different rates for residential and business customers. Residential customers pay $0.12 per kWh for the first 500 kWh. After the first 500 kWh, the rate is $0.15 per kWh. Business customers pay $0.16 per kWh for the first 800 kWh. After the first 800 kWh, the rate is $0.20 per kWh. Write a program to calculate energy charge. You must write and use the following two functions. (a) A main function: Ask the user to enter number of kWh used and customer type (enter R for residential or B for business). Call the bill calculator function and pass number of kWh used and customer type to it as arguments. You must use positional arguments to pass kWh used and customer type. (b)A bill calculator function: This function has two parameters to receive number of kWh used and customer type. Calculate and display the energy charge. The following is an example. Enter kilowatt hours used: 810 Enter R for residential customer, B for business customer: R Please pay this amount: 106.50 The following is another example. Enter kilowatt hours used: 810 Enter R for residential customer, B for business customer: b Please pay this amount: 130.00 Save your Python program in a file named Lab07P2.py. Submit the file to Blackboard for credit. PROBLEM 3 Rewrite Program 2. This is you must use keyword arguments to pass number of kWh and customer type to the bill calculator function when it is called. Save your Python program in a file named Lab07P3.py. Submit the file to Blackboard for credit

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!