JAVA PROGRAM(LL)+MINDTAP (1 TERM) V2.0
JAVA PROGRAM(LL)+MINDTAP (1 TERM) V2.0
9th Edition
ISBN: 9780357616673
Author: FARRELL
Publisher: CENGAGE L
bartleby

Videos

Question
Book Icon
Chapter 5, Problem 3PE

a.

Program Plan Intro

Determine the price of a selected room

Program plan:

  • Import necessary package.
  • Create a class “ShadyRestRoom”,
    • Define the method “main ()”,
      • Declare the necessary variables.
      • Declare the necessary final variables.
      • Create “Scanner” object.
      • Print the menu.
      • Prompt the user to enter the choice.
      • Get the choice from the user using “nextInt()”.
      • Check whether the choice is queen,
        • Assign the corresponding text for a queen.
        • Assign the corresponding price for a room.
      • Otherwise, check whether the choice is a king,
        • Assign the corresponding text for a king.
        • Assign the corresponding price for a room.
      • Otherwise, check whether the choice is a suite,
        • Assign the corresponding text for a suite.
        • Assign the corresponding price for a suite.
      • Otherwise,
        • Assign the invalid text.
        • Set the price value to “0”.
      • Print the output.

b.

Program Plan Intro

Determine the price of a selected view

Program plan:

  • Import necessary package.
  • Create a class “ShadyRestRoom2”,
    • Define the method “main ()”,
      • Declare the necessary variables.
      • Declare the necessary final variables.
      • Create “Scanner” object.
      • Print the menu.
      • Prompt the user to enter the choice.
      • Get the choice from the user using “nextInt()”.
      • Check whether the choice is queen,
        • Assign the corresponding text for a queen.
        • Assign the corresponding price for a room.
      • Otherwise, check whether the choice is a king,
        • Assign the corresponding text for a king.
        • Assign the corresponding price for a room.
      • Otherwise, check whether the choice is a suite,
        • Assign the corresponding text for a suite.
        • Assign the corresponding price for a suite.
      • Otherwise,
        • Assign the invalid text.
        • Set the price value to “0”.
      • Check whether the price is not equal to “0”,
        • Prompt the user to enter the view.
        • Print the view and the corresponding text.
        • Prompt the user to enter the choice of view.
        • Get the view choice from the user.
        • Check whether the choice is lake,
          • If it is true, assign the corresponding text for a lake.
          • Update the price.
            • Otherwise, check whether the choice is a park,
              • If it is true, assign the corresponding text for a park.
            • Otherwise,
              • Update the price.
              • Assign the error text message.
      • Print the output.

Blurred answer
Students have asked these similar questions
In C#, please?   Write a program named CheckMonth2 that prompts a user to enter a birth month and day. Display an error message that says Invalid date if the month is invalid (not 1 through 12) or the day is invalid for the month (for example, not between 1 and 31 for January or between 1 and 29 for February). If the month and day are valid, display them with a message. For example, if the month entered is 2, and the day entered is 17, the output should be 2/17 is a valid birthday.
Professor Zak allows students to drop the four lowest scores on the ten 100-point quizzes she gives during the semester. Design an application that accepts a student name and 10 quiz scores. Output the student's name and 10 quiz scores. Output the student's name and total points for the student's six highest-scoring quizzes. Modify the application so that the student's mean and median scores on the six best quizzes are displayed.
Professor Zak allows students to drop the four lowest scores on the ten 100-point quizzes she gives during the semester. Design an application that accepts a student name and 10 quiz scores. Output the student's name and 10 quiz scores. Output the student's name and total points for the student's six highest-scoring quizzes.
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
    Microsoft Visual C#
    Computer Science
    ISBN:9781337102100
    Author:Joyce, Farrell.
    Publisher:Cengage Learning,
Text book image
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781337671385
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT
Text book image
Microsoft Visual C#
Computer Science
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Cengage Learning,
C - File I/O; Author: Tutorials Point (India) Ltd.;https://www.youtube.com/watch?v=cEfuwpbGi1k;License: Standard YouTube License, CC-BY
file handling functions in c | fprintf, fscanf, fread, fwrite |; Author: Education 4u;https://www.youtube.com/watch?v=aqeXS1bJihA;License: Standard Youtube License