Question

Making Decisions III CellPhoneService.java + 1 import java.util.Scanner; 2 public class CellphoneService >- Ter Write a progr

0 0
Add a comment Improve this question Transcribed image text
Answer #1

CODE IN JAVA:

CellPhoneService.java file:

import java.util.Scanner;

public class CellPhoneService {

   public static void main(String[] args) {

       Scanner sc = new Scanner(System.in);
       int talkMinutes, messages, data;
       System.out.print("Enter talk minutes : ");
       talkMinutes = sc.nextInt();
       System.out.print("Enter text messates needed : ");
       messages = sc.nextInt();
       System.out.print("Enter gigabytes of data needed : ");
       data = sc.nextInt();
       if (data > 0) {
           if (data > 2) {
               System.out.println("The best recomended plan is F and the cost is $87");
           } else {
               System.out.println("The best recomended plan is E and the cost is $79");
           }
       } else if (talkMinutes > 500) {
           if (messages > 100) {
               System.out.println("The best recomended plan is D and the cost is $70");
           } else {
               System.out.println("The best recomended plan is C and the cost is $61");
           }
       } else {
           if (messages == 0) {
               System.out.println("The best recomended plan is A and the cost is $49");
           } else {
               System.out.println("The best recomended plan is B and the cost is $55");
           }
       }
   }

}

OUTPUT:

A Problems @ Javadoc Declaration Console X <terminated > Cell Phone Service [Java Application) C:\Program Files\ava\jdk-13.0.

Add a comment
Know the answer?
Add Answer to:
Making Decisions III CellPhoneService.java + 1 import java.util.Scanner; 2 public class CellphoneService >- Ter Write a...
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. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Write your code here user for maximum monthly values for talk minutes used

    Programming Exercise 5-4 Instructions Write your code here 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...

  • import java.util.Scanner; public class MPGMain {    public static void main(String[] args)    {       ...

    import java.util.Scanner; public class MPGMain {    public static void main(String[] args)    {        Scanner input = new Scanner(System.in);               Mileage mileage = new Mileage();               System.out.println("Enter your miles: ");        mileage.setMiles(input.nextDouble());               System.out.println("Enter your gallons: ");        mileage.setGallons(input.nextDouble());               System.out.printf("MPG : %.2f",mileage.getMPG());           } } public class Mileage {    private double miles;    private double gallons;    public double getMiles()...

  • How could I take this code and make a JavaFX program with the same results? import java.util.Scanner; public class CellPhoneApp { private static int[] data = {8,16,20}; private static doubl...

    How could I take this code and make a JavaFX program with the same results? import java.util.Scanner; public class CellPhoneApp { private static int[] data = {8,16,20}; private static double[] dataPrice = {45.00,65,.00,99.00}; private static int[] model ={100,110,200}; private static double[] modelPrice= {299.95,399.95,499.95}; private static String[] options = {"Phone Replacement Insurance","WiFi Hotspot Capability"}; private static double[] optionsPrice ={5.00,10.00}; private static Scanner scanner = new Scanner(System.in); public static void main(String[] args) { int planIndex = getDataPlan(); int modelIndex = getModel(); int...

  • finite mathematics an applied approach 11th edition, Sullivan, Chp 2, project page 101. // Should be in the book souliti...

    finite mathematics an applied approach 11th edition, Sullivan, Chp 2, project page 101. // Should be in the book soulitions but can't find it. 1. You decide to compare the basic charges for two cell phone plans that include texting and Web access. Here are the monthly costs for two plans.* Plan A includes a flat rate of $39.99 for 450 anytime minutes plus $.02 for each text message (sent or received) and $1.99 per megabyte of data usage (50...

  • Project 7-3 Guessing Game import java.util.Scanner; public class GuessNumberApp {    public static void main(String[] args)...

    Project 7-3 Guessing Game import java.util.Scanner; public class GuessNumberApp {    public static void main(String[] args) { displayWelcomeMessage(); // create the Scanner object Scanner sc = new Scanner(System.in); String choice = "y"; while (choice.equalsIgnoreCase("y")) { // generate the random number and invite user to guess it int number = getRandomNumber(); displayPleaseGuessMessage(); // continue until the user guesses the number int guessNumber = 0; int counter = 1; while (guessNumber != number) { // get a valid int from user guessNumber...

  • package week_3; import java.util.Scanner; import java.util.*; //import java.lang.*; //import java.io.*; /** Write a program that can...

    package week_3; import java.util.Scanner; import java.util.*; //import java.lang.*; //import java.io.*; /** Write a program that can help decide if a particular programming project is best solved using a Waterfall or Agile methodology. Your program should ask the user: • How many programmers will be on the team [ More than 30 programmers -> Waterfall ] • If there needs to be firm deadlines and a fixed schedule [ Yes - > Waterfall ] • If the programmers have experience in...

  • Write code for RSA encryption package rsa; import java.util.ArrayList; import java.util.Random; import java.util.Scanner; public class RSA...

    Write code for RSA encryption package rsa; import java.util.ArrayList; import java.util.Random; import java.util.Scanner; public class RSA {    private BigInteger phi; private BigInteger e; private BigInteger d; private BigInteger num; public static void main(String[] args) {    Scanner keyboard = new Scanner(System.in); System.out.println("Enter the message you would like to encode, using any ASCII characters: "); String input = keyboard.nextLine(); int[] ASCIIvalues = new int[input.length()]; for (int i = 0; i < input.length(); i++) { ASCIIvalues[i] = input.charAt(i); } String ASCIInumbers...

  • Java // Topic 2c // Program reserves airline seats. import java.util.Scanner public class Plane {    //...

    Java // Topic 2c // Program reserves airline seats. import java.util.Scanner public class Plane {    // checks customers in and assigns them a boarding pass    // To the human user, Seats 1 to 2 are for First Class passengers and Seats 3 to 5 are for Economy Class passengers    //    public void reserveSeats()    {       int counter = 0;       int section = 0;       int choice = 0;       String eatRest = ""; //to hold junk in input buffer       String inName = "";      ...

  • Use java and continue stage 2 and 3 stage 1 code public abstract class BabyItem { protected String name;...

    Use java and continue stage 2 and 3 stage 1 code public abstract class BabyItem { protected String name; public BabyItem() { name=""; } public BabyItem(String name) { this.name = name; } public String getName() { return name; } public void setName(String name) { } public abstract double getCost(); } ======================================================================================== public class BabyFood extends BabyItem { private int numberOfJars; private double pricePerDozen; public BabyFood() { super(); numberOfJars = 0; pricePerDozen = 0; } public BabyFood(int numberOfJars, double pricePerDozen) {...

  • This is the contents of Lab11.java import java.util.Scanner; import java.io.*; public class Lab11 { public static...

    This is the contents of Lab11.java import java.util.Scanner; import java.io.*; public class Lab11 { public static void main(String args[]) throws IOException { Scanner inFile = new Scanner(new File(args[0])); Scanner keyboard = new Scanner(System.in);    TwoDArray array = new TwoDArray(inFile); inFile.close(); int numRows = array.getNumRows(); int numCols = array.getNumCols(); int choice;    do { System.out.println(); System.out.println("\t1. Find the number of rows in the 2D array"); System.out.println("\t2. Find the number of columns in the 2D array"); System.out.println("\t3. Find the sum of elements...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT