Question
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
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. |
Task #2 Write another Java program, with at least two modules or functions, that will modify the above program so it also calculates and displays the amount of money Package A customers would save if they purchased Packages B or C, and the amount of money Package B customers would save if they purchased Package C. If there would be no savings, no message should be printed. This time the program should (1) use constants to represent the base rates and base hours, and (2) use DecimalFormat class to define format pattern and print total charges and total savings with $ in the front and two digits after decimal point with trailing zeros displayed. The hours must be limited from 0 to 720, any higher value give should result in a error given, example is given below.
The following are sample interactions that occur when running the program:
$ java InternetServiceProviderPart2
Enter the customer's package (A, B, or C): A
Enter the number of hours used: 10
The charges are $9.95
$ java InternetServiceProviderPart2
Enter the customer's package (A, B, or C): A
Enter the number of hours used: 20
The charges are $29.95
With package B you would have saved $16.00
With package C you would have saved $10.00
$ java InternetServiceProviderPart2
Enter the customer's package (A, B, or C): A
Enter the number of hours used: 30
The charges are $49.95
With package B you would have saved $26.00
With package C you would have saved $30.00
$ java InternetServiceProviderPart2
Enter the customer's package (A, B, or C): B
Enter the number of hours used: 777
Invalid input, please enter number of hours between 0 & 720.
Lets try again.
Enter the customer's package (A, B, or C): B
Enter the number of hours used: 40
The charges are $33.95
With package C you would have saved $14.00
$ java InternetServiceProviderPart2
Enter the customer's package (A, B, or C): C
Enter the number of hours used: 100
The charges are $19.95
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started