Answered step by step
Verified Expert Solution
Link Copied!
Question
1 Approved Answer

Class Room: Create Java file Room.java. The purpose of this class is to keep the record of each room of a given hotel. Later on,

Class Room: Create Java file Room.java. The purpose of this class is to keep the record of each room of a given hotel. Later on, you must use this class inside the Hotel class. Complete this Java class using the following specifications:

First define an enum, named RoomType, with four possible values:

SINGLE, DOUBLE, STUDIO, SUITE

Every room instance object has

o Room type (Hint: use enum you defined for the type of this variable.)

o price per night

o room size

o floor number

o room number

o description

o vacancy status

o ArrayList of all its reservations

A constructor with six parameters, room type, price, size, room number, floor, and description.

Note that you must also initialize the vacancy status and the list of reservations.

Getter methods for the vacancy status, room number, price, and list of the reservations.

A setter method for the price.

A method, reserve, which gives start date (inclusive), end date (exclusive), and guest, and will

reserve the room. Note that the room availability should be checked in this method. If it is available,

then it reserves the room and returns the reservation number, and otherwise returns zero.

A method, cancel, which gives a reservation number and will cancel that reservation.

Two methods, checkin and checkout, to set the vacancy type of the room, accordingly.

A method, status, which returns a string including the list of all the reservations of the room,

with a format like example below.

Reservation list of room number 102: Vacant.

Reservation Number: 10001. From: 2021-03-21 To: 2021-03-24, Guest: Joe Uncle, $50.5 per night.

Reservation Number: 10002. From: 2021-04-02 To: 2021-04-04, Guest: Lu Brother, $52.0 per night.

Override the toString method, such that it returns a string including the room information, with

the format like example below. The last part of the following example is the room description.

SINGLE, price=$35.5, Size=200.0, Number=101, Floor=1, Single Room without view

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

Students explore these related Databases questions