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.
1
Expert's answer
2016-03-25T10:23:04-0400
import java.util.*; public class Question_58689 { public static void main(String[] args) { int min,message,gigab; Scanner sc = new Scanner(System.in); System.out.print("enter minutes : "); min = sc.nextInt(); System.out.print("enter messages : "); message = sc.nextInt(); System.out.print("enter gigabytes : "); gigab = sc.nextInt(); if(min<500 && message == 0 && gigab == 0)System.out.println("Plan A, 49$ per month"); if(min<500 && message > 0 && gigab == 0)System.out.println("Plan B, 55$ per month"); if(min>=500 && gigab == 0 && message <=100 && message>0)System.out.println("Plan C, 61$ per month"); if(min>=500 && gigab == 0 && message >100)System.out.println("Plan D, 70$ per month"); if (gigab>0 && gigab <2) System.out.println("Plan E, 79$ per month"); if (gigab>0 && gigab >=2) System.out.println("Plan F, 87$ per month"); }
Comments
Leave a comment