Question
JAVA Task 1 Assume a mobile phone service provider has three different service plans for its customers: Mobile Phone Service Plan Plan A: Plan B:
JAVA
Task 1
Assume a mobile phone service provider has three different service plans for its customers: Mobile Phone Service Plan
Plan A: Plan B: Plan C:
$39.99 per month. 450 free minutes. Additional usage costs $0.45 per minute. $59.99 per month. 900 free minutes. Additional usage costs $0.40 per minute. $69.99 per month. Unlimited minutes.
Write statements that calculate and display the customers monthly bill as well as display saving information if the customer had used a different plan. The detailed tasks are as follows:
-
1) Display the above menu to the customer.
-
2) Prompt the user for his or her full name.
-
3) Ask which plan the customer has purchased. The program should accept lowercase or uppercase letter of A, B, and C. If the customer enters any other letter, display an error message and ask the customer to re-enter the plan name until a valid plan name is entered.
-
4) Ask how many minutes were used last month. The amount of minutes should be a non-negative value, otherwise display an error message and ask the user to re-enter the value until a valid number is entered.
-
5) Calculate the customer s monthly charge.
-
6) Display the customers full name and monthly charge on the screen.
-
7) Display how much money the customer would save if he/she switches to other plans. If there would be no savings by switching to other plans, display You chose the best plan.
The currency should be displayed with 2 decimal places as shown in the sample output.
Wherever possible, use named constants instead of numbers, for example, plan base cost, free minutes for a plan, and additional minute cost.
Hints:
Suggested steps:
-
1) Declare related constants or variables.
-
2) Display the menu
-
3) Prompt for user name, plan, and minutes used. Read user input and store into related variables.
Use while loop to validate user input.
-
4) Calculate costs for all three plans and save them in three variables for later cost comparison.
-
5) Use the switch statements to output monthly statement, compare costs of plans, and display
saving information if there is any saving by switching to other plan(s).
-
Hints:
Suggested steps:
-
1) Declare related constants or variables.
-
2) Display the menu
-
3) Prompt for user name, plan, and minutes used. Read user input and store into related variables.
Use while loop to validate user input.
-
4) Calculate costs for all three plans and save them in three variables for later cost comparison.
-
5) Use the switch statements to output monthly statement, compare costs of plans, and display
-
saving information if there is any saving by switching to other plan(s).
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