EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
9th Edition
ISBN: 9781337671385
Author: FARRELL
Publisher: CENGAGE LEARNING - CONSIGNMENT
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
a. Write an application for the Shady Rest Hotel; the program determines the price of a room. Ask the user to choose 1 for a queen bed, 2 for a king, or 3 for a king and a pullout couch. The output echoes the input and displays the price of the room: $125 for queen, $139 for king, and $165 for suite with king bed and a pullout couch. If the user enters an invalid code, display an appropriate message and set the price to Save the file as ShadyRestRoom.java.   Add a prompt to the ShadyRestRoom application to ask the user to specify a (1) lake view or a (2) park view, but ask only if the bed size entry is valid. Add $15 to the price of any room with a lake view. If the view value is invalid,display an appropriate message and assume that the price is for a room with a lake view. Save the file as ShadyRestRoom2.java.
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.
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.
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