ISYS 350, Fall 21, Assignment 3, Due Date: Wednesday, 10/6/21

 

Part 1:

 

An Internet service provider offers three subscription packages to its customers, plus a discount for nonprofit organizations:

 

Package A: 10 hours of access for $12.95 per month.  Additional hours are $4.00 per hour.

Package B: 20 hours of access for $14.95 per month.  Additional hours are $2.00 per hour.

Package C: Unlimited access for $35.95 per month.

           

A nonprofit organizations will get 20% discount on all packages.

 

Create a Python program that asks user to enter the following information:

 

  1. The Package customer selects
  2. The hours used
  3. Is the customer a non-profit organization

 

And compute the monthly charge accordingly. 

 

Input validation: The number of hours used in a month cannot exceed 744. 

 

Test your program with these data:

a. Package A using 10 hours and is non-profit.

b. Package B using 25 hours, not non-profit: cost: $24.95

c. Package C using 800 hours, is non-profit: cost: input error

 

Enter package (A, B, C): a

Enter hours used: 10

Are you a non-profit organization?(y/n): y

The service charge is: $10.36

>>> 

 

Enter package (A, B, C): b

Enter hours used: 25

Are you a non-profit organization?(y/n): n

The service charge is: $24.95

>>> 

 

Enter package (A, B, C): c

Enter hours used: 800

Are you a non-profit organization?(y/n): y

Hours cannot exceed 744!

Note: Considering the possibility that user may enter the package with uppercase or lowercase letter, you may use string’s upper() or lower() to convert the package to the case you want in order to determine the package correctly in your program.

 

2 Extra Credits:

 

An electric company charges customers based on Kilowatt-Hours (Kwh) used.  The rules to compute the charge are:

First 50 Kwh

35 cents per Kwh

Each of the next 100 Kwh (up to 150 Kwh), the first 50 Kwh used is still charged at 35 cents each

45 cents per Kwh

Each of the next 300 Kwh (up to 450 Kwh)

Kwhs used between 50 and 150 are charged at 45 cents each

65 cents per Kwh

All Kwh over 450,

Kwhs used between 150 and 450 are charged at 65 cents each

80 cents per KH

 

Create a Python program that asks a user to enter Kwh used, and compute the electricity charges.  The Kwh used could be a number with decimals. 

 

Requirements:

 

  1. Input validation: Kilowatt-Hours cannot exceed 2000. 
  2. Test your program with (1) Kwh=4500, (2) Kwh = 400

 

Turn in the program’s screenshot and the code.

 

Sample run:

 

Enter Kilowatt-Hours used: 400

Kilowatt-Hours used: 400.0 , charge is: $225.00

>>> 

 

Enter Kilowatt-Hours used: 4500

The Kilowatt-Hours used cannot be more than 2000!

>>> 

 

Copy the source code and paste to a Word document, and copy the output and  paste it to the same Word document.  Submit the Word document by email attachment.