Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Class Hotel (30 marks): Open the Java file Hotel.java that is provided. Note that every hotel is a building with some extra features. You must
Class Hotel (30 marks): Open the Java file Hotel.java that is provided. 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 (4 marks) o name orate 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 hotel's 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 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, Ploor=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) Alice Mama
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