Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

MINDTAP Frum Cengage Search this course A Programming Exercise 5-4 Instructions

ID: 3748928 • Letter: M

Question

MINDTAP Frum Cengage Search this course A Programming Exercise 5-4 Instructions CellPhoneServi.+ 1 import java.util.*; 2 public class CelLPhoneService 3 public static void main (String args]) Write a program for Horizon Phones, a Ll provider of cellular phone service. Prompta // Write your code here user for maximum monthly values for talk minutes used, text messages sent, and gigabytes of data used, and thern 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 3 gigabytes at $79 or Plan Ffor 3 gigabytes or more at $87 Grading

Explanation / Answer

//java program

import java.util.Scanner;

public class CellPhoneService {

public static void main(String args[]) {

int minutes,text,data;

Scanner in =new Scanner(System.in);

System.out.print("Enter talk minutes : ");

minutes=in.nextInt();

System.out.print("Enter text messages : ");

text=in.nextInt();

System.out.print("Enter data in GB : ");

data=in.nextInt();

if(minutes<500 && text==0 &&data==0)

System.out.println("plan A at $49");

else if(minutes<500 && text>0 &&data==0)

System.out.println("plan B at $55");

else if(minutes>=500 &&text<100 &&data==0)

System.out.println("plan C at $61");

else if(minutes>=500 &&text >= 100 &&data==0)

System.out.println("plan D at $70");

else if(minutes>=0 &&text>=0 &&data>0&&data<3)

System.out.println("plan E at $61");

else if(minutes>=0 &&text>=0 &&data>=3)

System.out.println("plan F at $87");

else System.out.println("no plan");

}

}