Question
You must consider this fact in the implementation of the class Hotel. Complete this Java class using the following specifications: Every hotel has (4 marks)
You must consider this fact in the implementation of the class Hotel. Complete this Java class using the following specifications:
-
Every hotel has (4 marks)
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. (1 mark)
-
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. (4 marks)
-
Provide getter methods for hotel name and owners. (2 marks)
-
Provide a getter method, getRooms, which returns the list of the hotel rooms as an ArrayList of
rooms. (1 mark)
-
Provide a getter method, getRoom, with one parameter, room number, which returns the
corresponding room as its return type, and otherwise null. (1 mark)
-
Provide a method, addOwner, which adds one owner to the hotels owners list. (1 mark)
-
Provide a method, addRoom, which adds a new room to the hotel. (1 mark)
-
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. (4 marks)
-
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. (3 marks)
-
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. (3 marks)
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. (5 marks)
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started