Question

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 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 F for 3 gigabytes or more at $87

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

import java.util.*;
public class CellPhoneService{

public static String calculateBestPlan(int talkMinCount, int textMesCount, float dataCount){

if(talkMinCount<500){ //fewer than 500 minutes of talk
if(textMesCount==0 || dataCount==0){ // No text or data (interpreted as "OR")
return "Recommend Plan is A at $49 per month";
}else if(textMesCount>0){ // any text messages needed
return "Recommend Plan is B at $55 per month";
}
}else{
if( dataCount==0){ //No data needed
if(textMesCount<100)
return "Recommend Plan is C at $61 per month"; // upto 100 messages
else
return "Recommend Plan is D at $70 per month";//more than 100 messages

}else{
if(dataCount<3){
return "Recommend Plan is E at $79 per month"; //data GB count
}else{
return "Recommend Plan is F at $87 per month";
}
}
}
return "Thank you for using our services!!!";
}


public static void main(String[] args) {


try{
// create a scanner so we can read the command-line input
Scanner scanner = new Scanner(System.in);

// prompt for the user for max monthly values for talk minutes used
System.out.print("Enter your maximum monthly values for talk minutes used ");
int talkMinCount = scanner.nextInt();

// prompt for text messages sent
System.out.print("Enter how many text messages you send every month ");
int textMesCount = scanner.nextInt();

// prompt for GB of data used
System.out.print("Enter how much data you use, in gigabytes ");
float dataCount = scanner.nextFloat();


System.out.println(calculateBestPlan(talkMinCount,textMesCount,dataCount));

}catch(Exception e){}

System.out.println("Please give correct values!!!");

}

}

Add a comment
Know the answer?
Add Answer to:
Write your code here user for maximum monthly values for talk minutes used
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Similar Homework Help Questions
  • Making Decisions III CellPhoneService.java + 1 import java.util.Scanner; 2 public class CellphoneService >- Ter Write a...

    Making Decisions III CellPhoneService.java + 1 import java.util.Scanner; 2 public class CellphoneService >- Ter Write a program for Horizon 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 as well as the price of that plan. public static void main (String args[]) // declare variables here // prompt user to enter talk minutes...

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

  • In PYTHON code: Examples of output are as follows: If the user entered Package A and...

    In PYTHON code: Examples of output are as follows: If the user entered Package A and 30 GB of data, then you should get the following output: Mobile Service Provider Enter your mobile phone package (A, B or C): A How many gigabytes data did you use? 30 Your total cost for Package A is 299.99 If you had chosen Package C you would have saved $ 230.00 If you had chosen Package B you would have saved $ 130.00...

  • (Q.1) Bridget Ashton is getting ready to open a small restaurant. She is on a tight...

    (Q.1) Bridget Ashton is getting ready to open a small restaurant. She is on a tight budget and must choose between the following long-distance phone plans: Plan A: Pay 10 cents per minute of long-distance calling Plan B: Pay a fixed monthly fee of $15 for up to 240 long-distance minutes, and 8 cents per minute thereafter (if she uses fewer than 240 minutes in any month, she still pays $15 for the month) Plan C: Pay a fixed monthly...

  • Bridget Jackson is getting ready to open a small restaurant. She is on a tight budget...

    Bridget Jackson is getting ready to open a small restaurant. She is on a tight budget and must choose between the following long-distance phone plans: (Click the icon to view the long-distance phone plans.) Read the requirements, Requirement 1. Match the graphs to the total monthly costs of the three plans for different levels of monthly long distance calling. Before we match the graphs to the plans, complete the following table, calculating the total costs for each plan at each...

  • (Q.1) Bridget Ashton is getting ready to open a small restaurant. She is on a tight...

    (Q.1) Bridget Ashton is getting ready to open a small restaurant. She is on a tight budget and must choose between the following long-distance phone plans: Plan A: Pay 10 cents per minute of long-distance calling. Plan B: Pay a fixed monthly fee of $15 for up to 240 long-distance minutes, and 8 cents per minute thereafter (if she uses fewer than 240 minutes in any month, she still pays $15 for the month). Plan C: Pay a fixed monthly...

  • Variable costs, fixed costs, total costs. Bridget Ashton is getting ready to open a small restaurant....

    Variable costs, fixed costs, total costs. Bridget Ashton is getting ready to open a small restaurant. She is on a tight budget and must choose betweern the following long-distance phone plans: Plan A: Pay 10 cents per minute of long-distance calling. Plan B: Pay a fixed monthly fee of $15 for up to 240 long-distance minutes and 8 cents per minute thereafter (if she uses fewer than 240 minutes in any month, she still pays $15 for the month). Plan...

  • Bridget Jackson is getting ready to open a small restaurant She won a tight budget and...

    Bridget Jackson is getting ready to open a small restaurant She won a tight budget and must choose between the following long distance phone plans Plan : Pay 8 cents per minute of long distance calling Plan Payceed monthly fee of 16 for up to 30 long distance minutes and 5 cents per minute thereafter she uses lower than 30 minutes in any month, shell pays $16 for the month) Plan C: Pay afbed monthly fee of $24 for up...

  • ayBridget Kanen is getting ready to open a small restaurant She is on a tight budget...

    ayBridget Kanen is getting ready to open a small restaurant She is on a tight budget and must choose between the foliowing long-distance phone plans LPlan A: Pay 7 cents per minute of long-distance calling Dat Plan B: Pay a fixed monthly tee of S17 for up to 260 long-distance minutes and 5 cents per minute thereafter (if she uses fewer than 260 minutes in any month, she still pays $17 for the month) Plan C: Pay a fixed monthly...

  • ANSWER ALL THREE QUESTIONS IN PICTURE AND FILL IN CHART three questions in the case study...

    ANSWER ALL THREE QUESTIONS IN PICTURE AND FILL IN CHART three questions in the case study need to be show in excel John Woo’s Cellular Connectsion Case Your Answer Which plan should he select? Which plan should he select at the following hours? 40 hours 45 hours 50 hours 55 hours 60 hours 65 hours 70 hours 75 hours 80 hour 85 hours Introduction to Spreadsheet Modeling CHAPTER 2 91 John Woo's Cellular Connections Background John Woo runs a small...

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