Write a program for Horizon Phones, a provider of cellular phone service. Prompt
ID: 671896 • Letter: W
Question
Write a program for Horizon 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 500 minutes of talk and no text or data should accept Plan A at $49 per month. A customer who needs fewer than 500 minutes of talk and any text messages should accept Plan B at $55 per month. A customer who needs 500 or more minutes of talk and no data should accept either Plan C for up to 100 text messages at $61 per month or Plan D for 100 text messages or more at $70 per month. A customer who needs any data should accept Plan E for up to 2 gigabytes at $79 or Plan F for 2 gigabytes or more at $87.
Explanation / Answer
package mani;
import java.util.Scanner;
public class HorizonPhones {
public static void main(String[] Args) {
Scanner scn=new Scanner(System.in);
int min,text,gigs;
System.out.print("Number of minutes: ");
min=scn.nextInt();
System.out.print("Number of text messages: ");
text=scn.nextInt();
System.out.print("Gigabytes of data needed: ");
gigs=scn.nextInt();
String plan="";
if(min<500&&text==0&&gigs==0){
plan="$49";
}if(min>=500&&gigs==0){
plan="$55";
}if(min>=500&&text<100&&gigs==0){
plan="$61";
}if(min>=500&&text>=100&&gigs==0){
plan="$70";
}if(gigs<2&&gigs!=0){
plan="$79";
}else if(gigs>=2){
plan="$87";
}
System.out.println("Plan you must select is plan: "+plan);
}
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.