EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
9th Edition
ISBN: 9781337671385
Author: FARRELL
Publisher: CENGAGE LEARNING - CONSIGNMENT
bartleby

Videos

Question
Book Icon
Chapter 5, Problem 4PE
Program Plan Intro

Recommendation of recharge plan

Program plan:

  • Import a necessary package.
  • Create a class “CellPhoneService”,
    • Define the method “main()”,
      • Declare and initialize the necessary variables.
      • Get the talk minutes entered into the first dialog box.
      • Assign the integer value returned from the method “parseInt()”.
      • Get the number of text messages entered into the second dialog box.
      • Assign the integer value returned from the method “parseInt()”.
      • Get the gigabytes of data entered into the third dialog box.
      • Assign the integer value returned from the method “parseInt()”.
      • Check whether the data balance is greater than “0”,
        • Check whether the data balance is less than or equal to the minimum data balance,
          • If it is true, set the plan to “E”.
          • Assign the price for the plan “E”.
        • Otherwise,
          • Set the plan to “F”.
          • Assign the price for the plan “F”.
      • Otherwise, check whether the required talk minutes is less than the minimum talk minutes,
        • If it is true, check whether the number of required text messages is “0” and required data balance is “0”,
          • If it is true, set the plan to “A”.
          • Assign the price for the plan “A”.
        • Otherwise,
          • Set the plan to “B”.
          • Assign the price for the plan “B”.
      • Otherwise, check whether the required number of text message is less than the minimum number of text messages,
        • If it is true, set the plan to “C”.
        • Assign the price for the plan “C”.
      • Otherwise,
        • Set the plan to “D”,
        • Assign the price for the plan “D”.
      • Concatenate the string with the determined plan and price.
      • Display the plan message in dialog box.

Blurred answer
Students have asked these similar questions
Write a program that asks users when their birthday is. Use information provided to give them their astrological sign. Each of the twelve signs should display a different horoscope. Use the following dates for each sign, keeping in mind that both month and day must be evaluated for an accurate result.    Aries: March 21–April 20 Taurus: April 21–May 21 Gemini: May 22–June 21 Cancer: June 22–July 22 Leo: July 23–August 22 Virgo: August 23–September 23 Libra: September 24–October 23 Scorpio: October 24–November 22 Sagittarius: November 23–December 21 Capricorn: December 22–January 20 Aquarius: January 21–February 19 Pisces: February 20–March 20
Write a program that calculates and prints the bill for a cellular telephone company. The company offers two types of service: regular and premium. Its rates vary, depending on the type of service. The rates are computed as follows:Regular Service: $10.00 plus first 50 minutes are free. - Charges for over 50 minutes are $0.20 per minute.Premium service: $25.00 plus - For calls made from 6:00 a.m. to 6:00 p.m.,the first 75 minutes are free;charges for more than 75 minutes are $0.10 per minute.- For calls made from 6:00 p.m. to 6:00 a.m., the first 100 minutes arefree; charges for more than 100 minutes are $0.05 per minute.Your program should prompt the user to enter an account number, a service code (type char), and the number of minutes the service was used. A service code of r or R means regular service; a service code of p or P means premium service. Treat any other character as an error. Your program should output the account number, type of service, number of minutes the telephone…
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. 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 for100 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. Save the file as CellPhoneService.java.
Knowledge Booster
Background pattern image
Computer Science
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
SEE MORE QUESTIONS
Recommended textbooks for you
  • Text book image
    EBK JAVA PROGRAMMING
    Computer Science
    ISBN:9781337671385
    Author:FARRELL
    Publisher:CENGAGE LEARNING - CONSIGNMENT
Text book image
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781337671385
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT
Java random numbers; Author: Bro code;https://www.youtube.com/watch?v=VMZLPl16P5c;License: Standard YouTube License, CC-BY