Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In Java Pls Problem: A Bed and Breakfast wants to develop an application that allows visitors to view their available rooms and easily Reserve one

In Java Pls

Problem:

A Bed and Breakfast wants to develop an application that allows visitors to view their available rooms and easily Reserve one to stay in.

You will need to create three classes.

  • The first class is your driver for the application and contains the main method. Name this class HotelApp.
  • The second class will process reservations for rooms. Name this class RoomReservation.

  • The third class is a helper class that stores information about a room. Name this class Room.

Design:

  • Your non-application classes RoomReservation and Room should have complete Javadoc comments

HotelApp class

This is the starting point for the application which is the only class to contain a main method.

This driver class will be used to control the user interactions, which include displaying the welcome message, displaying the room inventory, prompting the prospective visitor to select a room from inventory, and finally displaying a receipt. The class should include the following:

  • Follow the sample interaction on what to display for prompts, labels, messages and the flow for screen input and outputs.
  • Use both the RoomReservation and Room classes
  • Three methods:
    • A static method, main, that will:
      • Initiate the program, manage the flow of execution, and display the Reservation receipt
    • A static method, selectRoom, that will:
      • Display a welcome message and the room inventory
      • Prompt the user to select a room
    • A static method, selectExtras, that will:
      • Display extra services available
      • Prompt the user to select services
    • A static method, printReservation, that will:
      • displays the reservation receipt

RoomReservation class

This class keeps track of the information for each customer Reservation. This class should include the following:

  • Named Constants
    • Prices
      • Breakfast = $9.99
      • Crib = $14.50
      • Late Checkout = $29.99
    • Rates
      • sales tax = 6%
      • Service fee = 8%
  • Instance Variables
    • 7 instance variables: customer name, reservation date, pretax total, final total, number of visitors, room number, breakfast selected, crib selected, late checkout selected, and extras
  • Methods
    • Two constructors
      • A default constructor that initializes the reservation date to the current date/time
      • A constructor that accepts the customer name, room number and room price
    • Getters for number of visitors, customer name, room number, room price, breakfast selected, crib selected, late checkout selected, and extras
    • Setters for number of visitors, customer name, room number, room, price breakfast selected, crib selected, late checkout selected, and extras

  • setPreTaxTotal:
    • extras= breakfast if selected+ crib if selected+ late checkout if selected
    • pretax total = room + extras

  • setTotalPrice
    • reservation sales tax = pretax total * sales tax
      • round this value to 2 decimal places prior to storing
    • reservation service fee = pretax total * service fee
      • round this value to 2 decimal places prior to storing
    • final total = pretax total + reservation sales tax + reservation service fee

  • Override the toString method to display the reservation receipt

Room class

This class is helper class and is useful for storing Room information for the room inventory. This class should include the following:

  • Instance Variables
    • 5 instance variables: room number, capacity, number of beds, number of bathrooms, and price
  • Methods
    • One constructor that accepts all the instance variables
    • Getters for each instance variable
    • Setters for price and capacity
    • Override the toString method to display the room description in the form of room number, beds, price (e.g. 201, 2 beds, $200.00)

Submission:

  1. Zip your .java files for all of the classes together into a zip file.
  • HotelApp.java
  • RoomReservation.java
  • Room.java

Sample Run 1

*******************************************

****Welcome to The Best Bed & Breakfast****

*******************************************

Currently we have these rooms available:

101, 3 beds, $350

103, 2 beds, $200

204, 1 bed, $150

Please type in the room number you would like to reserve:101

*********************************

You have selected room number 101

would you like to add breakfast? (Y/N): y

would you like to add a crib? (Y/N): n

would you like to add late checkout? (Y/N): n

****************************************

*****Room 101 successfully reserved*****

****************************************

Room: $350.00

Extras: $9.99

Total before tax: $359.99

Sales tax: $21.59

Service fee: $28.79

Total after tax: $410.37

****************************************

*****Thank you for your reservation*****

****************************************

Sample Run 2

*******************************************

****Welcome to The Best Bed & Breakfast****

*******************************************

Currently we have these rooms available:

101, 3 beds, $350

103, 2 beds, $200

204, 1 bed, $150

Please type in the room number you would like to reserve:103

*********************************

You have selected room number 103

would you like to add breakfast? (Y/N): n

would you like to add a crib? (Y/N): n

would you like to add late checkout? (Y/N): n

****************************************

*****Room 103 successfully reserved*****

****************************************

Room: $200.00

Extras: $0.00

Total before tax: $200.00

Sales tax: $12.00

Service fee: $16.00

Total after tax: $228.00

****************************************

*****Thank you for your reservation*****

****************************************

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions