Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Instruction and Problems Write a Python program for each of the problems in this lab. Please use PyCharm to type and test your programs. Submit

Instruction and Problems

Write a Python program for each of the problems in this lab. Please use PyCharm to type and test your programs. Submit the Python files to Blackboard for credit. In this lab, you should submit 4 Python files, one for each problem.

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.5

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.0

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_2

Step: 3

blur-text-image_3

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

Transactions On Large Scale Data And Knowledge Centered Systems Xxviii Special Issue On Database And Expert Systems Applications Lncs 9940

Authors: Abdelkader Hameurlain ,Josef Kung ,Roland Wagner ,Qimin Chen

1st Edition

3662534541, 978-3662534540

More Books

Students also viewed these Databases questions

Question

Is it appropriate to your goal and audience?

Answered: 1 week ago