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

Class Hotel : Create Java file Hotel.java . Note that every hotel is a building with some extra features. You must consider this fact in

Class Hotel: Create Java file Hotel.java . Note that every hotel is a

building with some extra features. You must consider this fact in the implementation of the class Hotel.

Complete this Java class using the following specifications:

Every hotel has

o name

o rate

o one or more owners

o one or more rooms

Provide the default constructor for the class, which only calls the default constructor of its

superclass.

Provide the second constructor for the class, with five parameters, hotel name, list of the hotel

owners, year of built, number of floors, and hotel rate, which initializes the corresponding instance

variables. Note that the proper constructor of the superclass must be called in this constructor. Also,

the list of the hotel rooms must be initialized.

Provide getter methods for hotel name and owners.

Provide a getter method, getRooms, which returns the list of the hotel rooms as an ArrayList of

rooms.

Provide a getter method, getRoom, with one parameter, room number, which returns the

corresponding room as its return type, and otherwise null.

Provide a method, addOwner, which adds one owner to the hotels owners list.

Provide a method, addRoom, which adds a new room to the hotel.

Provide a method, reserve, with four parameters, room number, start date, end date, and guest. It

will first find the room using one of the above methods. If it finds the room, then it simply calls the

reserve method of that room, receives the reservation number and returns it. If the room is not

found, it returns zero, which means the reservation was not successful.

Provide a method, cancel, with one parameter, reservation number. It should find the room that

has this reservation numbers. If it finds the room, then it will call the cancel method of that room

with the reservation number given, and then returns true. Otherwise, it returns false, which means

the cancellation was not successful.

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

the format like example below. It shows the hotel information, followed by the rooms information.

Hotel Baba Mama, 3.5 stars.

Hotel Owners: Ali Baba Alice Mama

Rooms:

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

DOUBLE, price=$50.5, Size=350.0, Number=102, Floor=1, Double Room without view

DOUBLE, price=$55.0, Size=400.0, Number=201, Floor=2, Double Room with view

SUITE, price=$80.0, Size=500.0, Number=202, Floor=2, Suite Room with view and balcony

Provide standard Java Documentation for all the public methods as well as one brief explanation

for the Hotel class at the top of the class. Note that your documentation must follow the correct

syntax of Java Documentation and not just simple comments.

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

Temporal Databases Research And Practice Lncs 1399

Authors: Opher Etzion ,Sushil Jajodia ,Suryanarayana Sripada

1st Edition

3540645195, 978-3540645191

More Books

Students explore these related Databases questions