Question

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

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

I need the CellPhoneServiceTest.java to have the main method and all the objects in the CellPhoneService.java. The CellPhoneServiceTest.java should call the information from CellPhoneService.java with CellPhoneService c = new CellPhoneService();

Homework Answers

Answer #1

Code is Given Below:

=========================

CellPhoneService.java

============================

public class CellPhoneService {
   //declaring variable to hold minutes,messages and data
   int minutes;
   double data;
   int message;
  
  
   //this method will find best plan to print details
   public void getBestPlan() {
       //checking for best plan
       if(minutes<400 && data==0 && message==0) {
           System.out.println("Best Plan For you is A at $29 only");
           return;
       }
       if(minutes<400 && message>0 && data==0) {
           System.out.println("Best Plan For you is B at $35 only");
           return;
          
       }
       if(minutes>=400 && message<=100 && data==0) {
           System.out.println("Best Plan For you is C at $45 only");
           return;
       }
       if(minutes>=400 && message>100 && data==0) {
           System.out.println("Best Plan For you is D at $50 only");
           return;
          
       }
       if(data<=2) {
           System.out.println("Best Plan For you is E at $59 only");
           return;
       }
       if(data>2) {
           System.out.println("Best Plan For you is F at $65 only");
           return;
       }
      
   }

}

CellPhoneServiceTest.java

===========================

import java.util.Scanner;

public class CellPhoneServiceTest {
   public static void main(String[] args) {
       //creating scanner object to get data from user
       Scanner scn=new Scanner(System.in);
       //asking user to enter data
       System.out.print("Enter maximum monthly values for talk minutes used: ");
       int minutes=scn.nextInt();
       System.out.print("Enter maximum monthly values for text messages sent: ");
       int message=scn.nextInt();
       System.out.print("Enter maximum monthly values for gigabytes of data used: ");
       double data=scn.nextDouble();
       //creating cell phone service object
       CellPhoneService c=new CellPhoneService();
       //setting data to object
       c.minutes=minutes;
       c.message=message;
       c.data=data;
       //calling getBestPlan method
       c.getBestPlan();
   }

}

Output:

==============

Code Snapshot:

=============

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
Write a program in Java that: 1. will prompt user with a menu that contains options...
Write a program in Java that: 1. will prompt user with a menu that contains options to: a. Add a To-Do Item to a todo list. A To-Do Item contains: i. An arbitrary reference number (4; 44,004; etc.) ii. A text description of the item ("Pick up dry cleaning", etc.) iii. A priority level (1, 2, 3, 4, or 5) b. View an item in the list (based on its reference number) c. Delete an item from the list (based...
2. My monthly demand for cell phone service is as follows: − I am willing to...
2. My monthly demand for cell phone service is as follows: − I am willing to pay up to $1 per minute for the first 10 minutes of use per month. − I am willing to pay up to $0.50 per minute for the next 20 minutes per month. − For all minutes beyond the 30th (covered above), my demand is P = 0.50 – Q/100. P is in dollars and Q is minutes.(You should think of those as additional...
**JAVA LANGUAGE** Write a program that models an employee. An employee has an employee number, a...
**JAVA LANGUAGE** Write a program that models an employee. An employee has an employee number, a name, an address, and a hire date. A name consists of a first name and a last name. An address consists of a street, a city, a state (2 characters), and a 5-digit zip code. A date consists of an integer month, day and year. All fields are required to be non-blank. The Date fields should be reasonably valid values (ex. month 1-12, day...
Program Behavior Each time your program is run, it will prompt the user to enter the...
Program Behavior Each time your program is run, it will prompt the user to enter the name of an input file to analyze. It will then read and analyze the contents of the input file, then print the results. Here is a sample run of the program. User input is shown in red. Let's analyze some text! Enter file name: sample.txt Number of lines: 21 Number of words: 184 Number of long words: 49 Number of sentences: 14 Number of...
Using Java, write a program that allows the user to play the Rock-Paper-Scissors game against the...
Using Java, write a program that allows the user to play the Rock-Paper-Scissors game against the computer through a user interface. The user will choose to throw Rock, Paper or Scissors and the computer will randomly select between the two. In the game, Rock beats Scissors, Scissors beats Paper, and Paper beats Rock. The program should then reveal the computer's choice and print a statement indicating if the user won, the computer won, or if it was a tie. Allow...
<?php    if(isset($_GET['submit'])){ //sanitize the input        /* Check the error from the input: if...
<?php    if(isset($_GET['submit'])){ //sanitize the input        /* Check the error from the input: if input from user is empty -> get an error string variable if input is not empty -> use preg_match() to match the pattern $pattern = "/^[1-9][0-9]{2}(\.|\-)[0-9]{3}(\.|\-)[0-9]{4}$/"; -> if it's a matched, get a success string variable */           } ?> <!doctype html> <html lang="en"> <head> <!-- Required meta tags --> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> <!-- Bootstrap CSS --> <link...
he Saskatoon Credit Union selected a sample of 40 student chequing accounts. Below are their end-of...
he Saskatoon Credit Union selected a sample of 40 student chequing accounts. Below are their end-of the-month balances, in dollars: $ 674 472 56 573 916 244 402 498 722 271 853 204 598 759 819 828 154 179 547 67 363 344 951 183 785 322 769 459 215 393 401 468 67 679 188 452 64 647 851 568 a. Tally the data into a frequency distribution using $100 as a class interval and $0 as the starting...
Using C++, Python, or Java, write a program that: In this programming exercise you will perform...
Using C++, Python, or Java, write a program that: In this programming exercise you will perform an empirical analysis of the QuickSort algorithm to study the actual average case behavior and compare it to the mathematically predicted behavior. That is, you will write a program that counts the number of comparisons performed by QuickSort on an array of a given size. You will run the program on a large number of arrays of a certain size and determine the average...
Write a Python 3 program called “parse.py” using the template for a Python program that we...
Write a Python 3 program called “parse.py” using the template for a Python program that we covered in this module. Note: Use this mod7.txt input file. Name your output file “output.txt”. Build your program using a main function and at least one other function. Give your input and output file names as command line arguments. Your program will read the input file, and will output the following information to the output file as well as printing it to the screen:...
c++ Program Description You are going to write a computer program/prototype to process mail packages that...
c++ Program Description You are going to write a computer program/prototype to process mail packages that are sent to different cities. For each destination city, a destination object is set up with the name of the city, the count of packages to the city and the total weight of all the packages. The destination object is updated periodically when new packages are collected. You will maintain a list of destination objects and use commands to process data in the list....
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT