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 Mobile.java

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


Write a Java program to do the following:

Specifics:

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 Mobile.java

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

Solutions

Expert Solution

Hey mate, below is provided two separated java projects with one file is saved as Mobile.java and the other is MobileTest.java. The MobileTest.java contains the main method of the program which also creates a Mobile class object (m) to show the working of the two java files as a single program.

Mobile.java

public class Mobile{
    
    int talkMin,textMes,dataGiga;
    
    void plan(int talkMin,int textMes,int dataGiga){

        if(talkMin<400 && dataGiga==0)
     {
        if(textMes==0)
        {
            System.out.println("Plan A at $29 per month");
        }
        
        else{
            System.out.println("Plan B at $35 per month");
        }
     }
    
    else if(talkMin>=400 && dataGiga==0)
     {
        if(textMes<=100)
        {
            System.out.println("Plan C at $45 per month");
        }
        
        else{
            System.out.println("Plan D at $50 per month");
        }
     }
    
    else if(dataGiga>0)
     {
        if(dataGiga<=2)
        {
            System.out.println("Plan E at $59 per month");
        }
        
        else{
            System.out.println("Plan F at $65 per month");
        }
     }
    
    else{
        System.out.println("Sorry, no plans available for you");
     }
    }
    
}

MobileTest.java

import java.util.Scanner;

class MobileTest{
    
    public static void main (String[] args) {
         Mobile m=new Mobile();
         Scanner s=new Scanner(System.in);
         System.out.println("\nEnter the following details on your monthly basis:");
         System.out.print("Maximum talk minutes used:");
         m.talkMin=s.nextInt();
         System.out.print("Text messages sent:");
         m.textMes=s.nextInt();
         System.out.print("Data usage in gigabytes:");
         m.dataGiga=s.nextInt();
    
         System.out.print("\nYou are advised to buy:   ");
         m.plan(m.talkMin, m.textMes, m.dataGiga);
    
    }
}

Sample Output


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 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 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 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