Package HotelReservationSystem
Class Hotel
java.lang.Object
HotelReservationSystem.Hotel
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanBooks a room and makes a reservation, if possiblevoidchangeDPMs(int day, double newDPM) Changes the date price modifier for a specific daybooleanchangePrice(double newPrice) changes the price of all rooms in the hotel, if and only if there are no reservationsvoidchangeRoomName(String name) Changes the name of the rooms in the hotelvoiddelRoom(int index) User I/O for deleting room.fetchAvails(int type, int date) return an array of the names of the available or booked for a dayreturn the room given the name of the room of a hotelNamedoubleGets the average DPM of all the rooms in the hoteldoubleGetter for the base price of the HoteldoubleGetter for the earnings of the HotelgetName()Getter for the name of the HotelintGetter for the number of reservations in the HotelGetter for the ArrayList of reservation objects in the HotelintGetter for the number of rooms in the HotelgetRooms()Getter for the Arraylist of Room objects in the HotelnewRoom(int type) creates a new room in the hotel, if possiblevoidPrepares a hotel for removal by resetting all its variablesbooleanremoveReservation(String guestName, int checkinDate) Removes the reservation from a hotel room.int[]Counts the number of rooms for each room typevoidsetBasePrice(double basePrice) Sets the base price of the HotelvoidsetEarnings(double earnings) Sets the earnings of the HotelvoidSets the name of the HotelvoidsetReservationCount(int reservationCount) Setter for the number of reservations in the HotelvoidsetReservations(ArrayList<Reservation> reservation) Sets the reservation of the HotelvoidsetRoomCount(int roomCount) Setter for the number of rooms in the HotelvoidSets the rooms in the Hotel
-
Constructor Details
-
Hotel
-
-
Method Details
-
getBasePrice
public double getBasePrice()Getter for the base price of the Hotel- Returns:
- base price of the Hotel
-
setBasePrice
public void setBasePrice(double basePrice) Sets the base price of the Hotel- Parameters:
basePrice- base price of the hotel
-
getName
-
setName
Sets the name of the Hotel- Parameters:
name- The name of the Hotel
-
getReservations
Getter for the ArrayList of reservation objects in the Hotel- Returns:
- the ArrayList of Reservation objects
-
setReservations
Sets the reservation of the Hotel- Parameters:
reservation- The reservation in the Hotel
-
getRooms
-
setRooms
-
getEarnings
public double getEarnings()Getter for the earnings of the Hotel- Returns:
- The earnings of the Hotel
-
setEarnings
public void setEarnings(double earnings) Sets the earnings of the Hotel- Parameters:
earnings- The earnings of the Hotel
-
getRoomCount
public int getRoomCount()Getter for the number of rooms in the Hotel- Returns:
- The number of rooms in the Hotel
-
setRoomCount
public void setRoomCount(int roomCount) Setter for the number of rooms in the Hotel- Parameters:
roomCount- The number of rooms in the hotel
-
getReservationCount
public int getReservationCount()Getter for the number of reservations in the Hotel- Returns:
- The number of reservations in the Hotel
-
setReservationCount
public void setReservationCount(int reservationCount) Setter for the number of reservations in the Hotel- Parameters:
reservationCount- The number of reservations in the hotel
-
newRoom
creates a new room in the hotel, if possible- Parameters:
type- the type of room- Returns:
- {Room} if a new room is created, {null} if otherwise
-
bookRoom
Books a room and makes a reservation, if possible- Parameters:
guestName- the guests namecheckin- date of checking incheckout- date of checking outtype- the type of room the user wants to bookcode- discount code- Returns:
- {true} if room booking is successful, {false} if room booking is not successful
-
fetchRoom
-
fetchAvails
return an array of the names of the available or booked for a day- Parameters:
type- {1} method gets the available rooms, {otherwise} method gets the booked roomsdate- the date- Returns:
- {avails} the names of the rooms that are available on the date, {booked} the names of the rooms that are booked on the date
-
changePrice
public boolean changePrice(double newPrice) changes the price of all rooms in the hotel, if and only if there are no reservations- Parameters:
newPrice- the new price, constraint: newPrice >= 100- Returns:
- {true} if the base price is successfully changed, {false} if otherwise
-
delRoom
public void delRoom(int index) User I/O for deleting room. Uses `delRoom`- Parameters:
index- the room number to delete
-
changeRoomName
Changes the name of the rooms in the hotel- Parameters:
name- name of the hotel
-
removeReservation
Removes the reservation from a hotel room.- Parameters:
guestName- the name of the guestcheckinDate- the date of the guest's check in- Returns:
- {true} if the reservation was removed, {false} otherwise
-
prepareForRemoval
public void prepareForRemoval()Prepares a hotel for removal by resetting all its variables -
getAverageDPM
public double getAverageDPM()Gets the average DPM of all the rooms in the hotel- Returns:
- the average DPM
-
changeDPMs
public void changeDPMs(int day, double newDPM) Changes the date price modifier for a specific day- Parameters:
day- the day that will be changednewDPM- the new DPM for the day
-
roomTypeCount
public int[] roomTypeCount()Counts the number of rooms for each room type- Returns:
- an array of rooms with the same type.
-