Question

In: Computer Science

Write a program for XXX Phones, a provider of cellular phone service. Prompt a user for...

Write a program for XXX Phones, a provider of cellular phone service. Prompt a user for maximum monthly values for talk minutes used, text messages sent, and gigabytes of data used, and then recommend the best plan for the customer’s needs. A customer who needs fewer than 400 minutes of talk and no text or data should accept Plan A at $29 per month. A customer who needs fewer than 400 minutes of talk and any text messages should accept Plan B at $35 per month. A customer who needs 400 or more minutes of talk and no data should accept either Plan C for up to 100 text messages at $45 per month or Plan D for 100 text messages or more at $50 per month. A customer who needs any data should accept Plan E for up to 2 gigabytes at $59 or Plan F for 2 gigabytes or more at $65. Save the file as CellPhoneService.java

Again, Don’t forget to create the application/project CellPhoneServiceTest.java Class that has the main method and an object to use the CellPhoneService class.

Solutions

Expert Solution

import java.util.Scanner;

public class CellPhoneService {
  
private static final int PLAN_A = 29;
private static final int PLAN_B = 35;
private static final int PLAN_C = 45;
private static final int PLAN_D = 50;
private static final int PLAN_E = 59;
private static final int PLAN_F = 65;
  
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
char yesno;
  
do
{
System.out.print("Enter the maximum number of monthly call minutes required: ");
int callMinutes = Integer.parseInt(sc.nextLine().trim());
System.out.print("Enter the maximum number of monthly text messages required: ");
int textMessages = Integer.parseInt(sc.nextLine().trim());
System.out.print("Enter the maximum GB of data required: ");
int dataUsed = Integer.parseInt(sc.nextLine().trim());
suggestPlan(callMinutes, textMessages, dataUsed);
System.out.print("\nContinue? [y/n]: ");
yesno = sc.nextLine().trim().charAt(0);
if(yesno == 'N' || yesno == 'n')
break;
System.out.println();
}while(yesno != 'N' || yesno != 'n');
}
  
private static void suggestPlan(int call, int text, int data)
{
if(call < 400 && text == 0 && data == 0)
System.out.println("You can choose PLAN A at $" + PLAN_A);
else if(call < 400 && text > 0 && data == 0)
System.out.println("You can choose PLAN B at $" + PLAN_B);
else if(call >= 400 && text <= 100 && data == 0)
System.out.println("You can choose PLAN C at $" + PLAN_C);
else if(call >= 400 && text >= 100 && data == 0)
System.out.println("You can choose PLAN D at $" + PLAN_D);
else if(call >= 400 && text > 0 && data <= 2)
System.out.println("You can choose PLAN E at $" + PLAN_E);
else if(call >= 400 && text > 0 && data >= 2)
System.out.println("You can choose PLAN F at $" + PLAN_F);
}
}

********************************************************* SCREENSHOT *******************************************************


Related Solutions

Write a program for XXX Phones, a provider of cellular phone service. Prompt a user for...
Write a program for XXX Phones, a provider of cellular phone service. Prompt a user for maximum monthly values for talk minutes used, text messages sent, and gigabytes of data used, and then recommend the best plan for the customer’s needs. A customer who needs fewer than 400 minutes of talk and no text or data should accept Plan A at $29 per month. A customer who needs fewer than 400 minutes of talk and any text messages should accept...
A cellular phone service provider is offering a new calling plan that it claims will result...
A cellular phone service provider is offering a new calling plan that it claims will result in an average savings of more than 20% for its customers who switch to the plan. To evaluate this claim, a consumer watchdog organization contacted a random sample of this provider's customers who enrolled in the new plan and computed their individual savings (as a percentage of their original monthly bill). PctSavings(%) 9.84 14.13 15.01 23.47 19.07 21.37 19.64 22.38 26.56 22.52 23.11 18.77...
Problem: Your have been asked by a cell phone service provider to write a program that...
Problem: Your have been asked by a cell phone service provider to write a program that will calculate the amount of a customer’s monthly bill. Write a C++ program that will calculate the amount of the bill given the number of lines and the amount of minutes used during the month. Unlimited texting is also offered. ' The cellular service provider offers the following options and pricing: One line for $6/month base cost. Two lines for $12/month base cost. The...
IN C This assignment is to write a program that will prompt the user to enter...
IN C This assignment is to write a program that will prompt the user to enter a character, e.g., a percent sign (%), and then the number of percent signs (%) they want on a line. Your program should first read a character from the keyboard, excluding whitespaces; and then print a message indicating that the number must be in the range 1 to 79 (including both ends) if the user enters a number outside of that range. Your program...
Write a program that calculates the salary of employees. The program should prompt the user to...
Write a program that calculates the salary of employees. The program should prompt the user to enter hourly rate and number of hours of work a day. Then, the program should display the salary daily, bi-weekly (5 days a week), and monthly. Sample program: Enter your hourly rate: >>> 20 Enter how many hours you work a day: >>> 8 Your daily salary is: $160 Your bi-weekly salary is: $1600 Your monthly: $3200
Write a C program Your program will prompt the user to enter a value for the...
Write a C program Your program will prompt the user to enter a value for the amount of expenses on the credit card. Retrieve the user input using fgets()/sscanf() and save the input value in a variable. The value should be read as type double. The user may or may not enter cents as part of the input. In other words, expect the user to enter values such as 500, 500.00 and 500.10. The program will then prompt the user...
Write by hand a full java program that will prompt the user for the length and...
Write by hand a full java program that will prompt the user for the length and width of a square, calculate and display the area of that square rounded to the nearest tenth with an appropriate message.
Write a program that uses input to prompt a user for their name and then welcomes...
Write a program that uses input to prompt a user for their name and then welcomes them. Note that input will pop up a dialog box. Enter Sarah in the pop-up box when you are prompted so your output will match the desired output.(In Python)
write a program to perform the following in C Your program should prompt the user to...
write a program to perform the following in C Your program should prompt the user to enter ten words, one at a time, which are to be stored in an array of strings. After all of the words have been entered, the list is to be reordered as necessary to place the words into alphabetical order, regardless of case. Once the list is in alphabetical order, the list should be output to the console in order. The program should execute...
QUESTION THREE A cellular phone manufacturer situated in Kalabo district of western province (katondo cellular phones...
QUESTION THREE A cellular phone manufacturer situated in Kalabo district of western province (katondo cellular phones limited) produces three types of cellphones: Basic, Super and Delux. For the current year the company has a total of 10,000 direct labour hours and 7,500 machine hours available for production. Here below, are the sales and production parameters relating to the three types of cellphones: 4 Basic Super Delux Direct material @ K24/kg 0.75 kgs 0.625 kg 1.25 kg Direct labour @ k24...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT