Answer:
mport java.util.Scanner;
public class CellPhoneService
{
public static void main (String args[])
{
Scanner sc=new Scanner(System.in);
System.out.println("Enter the Talk minutes");
int talkmin=sc.nextInt();
System.out.println("Enter the text message");
int textmsg=sc.nextInt();
System.out.println("Enter the Gigabyte Data");
int gbdata=sc.nextInt();
if(talkmin<500 && textmsg==0 && gbdata==0)
System.out.println("PLAN A IS RECOMMENDED FOR THIS USER at 49$ per month");
else if(talkmin<500 && textmsg>0 && gbdata==0)
{
System.out.println("PLAN B IS RECOMMENDED FOR THIS USER at 55$ permonth");
}
else if(talkmin>=500 && textmsg<100 && gbdata==0)
{
System.out.println("PLAN C IS RECOMMENDED FOR THIS USER at 61$ permonth");
}
else if(talkmin>=500 && textmsg>=100 && gbdata==0)
{
System.out.println("PLAN D IS RECOMMENDED FOR THIS USER at 70$ permonth");
}
else if(gbdata>0 && gbdata<2)
{
System.out.println("PLAN E IS RECOMMENDED FOR THIS USER at 79$ permonth");
}
else if(gbdata>=2)
{
System.out.println("PLAN F IS RECOMMENDED FOR THIS USER at 87$ permonth");
}
}
}
Explanation:
- Take the talk minute and text message as input from user.
- Apply the conditional statement to check if talk minute is less than 500 along with text message and GB data having a value 0.
- At last check if GB data is greater than or equal to 2, then print the relevant response.