Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Task #1 An Internet service provider has three different subscription packages for its customers: Package A For $9.95 per month 10 hours of access are

Task #1 An Internet service provider has three different subscription packages for its customers:

Package A

For $9.95 per month 10 hours of access are provided.

Additional hours are $2.00 per hour.

Package B

For $13.95 per month 20 hours of access are provided.

Additional hours are $1.00 per hour.

Package C

For $19.95 per month unlimited access is provided.

Write program, with at least two modules or functions, that calculates a customer's monthly bill. It should ask the user to enter the letter of the package the customer has purchased (A, B, or C) and the number of hours (integer) that were used. It should then display the total charges and stop. If the user inputs an invalid package (other than A, B, or C) or invalid number of hours (<0 or> 30*24), the program should display an appropriate error message and ask again (loop) the user to enter the letter of the package the customer has purchased (A, B, or C) and the number of hours (integer) that were used.

The following are sample interactions that occur when running the program:

$ java InternetServiceProviderPart1

Enter the customer's package (A, B, or C): D

Invalid package. Enter A, B, or C.

Let's try again.

Enter the customer's package (A, B, or C): C

Enter the number of hours used: 5

The charges are $19.95

$ java InternetServiceProviderPart1

Enter the customer's package (A, B, or C): A

Enter the number of hours used: 721

Invalid input, please enter number of hours between 0 & 720.

Let's try again.

Enter the customer's package (A, B, or C): A

Enter the number of hours used: 20

The charges are $29.95

$ java InternetServiceProviderPart1

Enter the customer's package (A, B, or C): B

Enter the number of hours used: 20

The charges are $13.95

$ java InternetServiceProviderPart1

Enter the customer's package (A, B, or C): C

Enter the number of hours used: 80

The charges are $19.95

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

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Programming questions