To get the code running, please download the repo and run main.py, you can select a test case (testCases.py). Please look at the test cases to see how the program is initialized.
This program is a basic hotel reservation system. It is my first true OOP based project. A hotel can be defined with any number of rooms of 3 different suites: Standard, Deluxe, Executive (varying prices). The features are:
- Any number of customers can be added and stored in a database. Each customer has a unique ID which is used to create/modify/cancel a booking.
- Each room has a calendar that keeps track of bookings. The calendar length is customizable - i.e. the booking date range can be up to the user (90-120 days ahead is a good value). This is meant for realism, you can't book something 10 years in advance!
- Reservations can be cancelled or modified. Refunds are also provided.
- Each customer has an Invoice which prints the bill at the end and is updated if the reservation is cancelled or modified.
- The program shows the user which rooms are available on the selected dates, along with the range of booking dates possible (how late the checkout date can be). If a room is sold out for the dates requested, it will not show up on the list.
The following describes the current limitations of the program, as the degree of complexity is endless:
- There is only one Hotel
- If the user inputs incorrect values or data types, there is an error message provided, however the function has to be re-initialized again. However to avoid this happening, the program provides prompts throughout - as in point 5 above.
- There is no housekeeping or receptionist assigned to each room.
- The price of each suite type is uniform and holidays are not considered.
- If 2 customers have the same first name and last name letter, along with the same last 4 digits of phone number, this will conflict the ID, however what are the chances of that in real life!
- Sold out Hotel
- Incorrect customer ID selected
- Overlapping of booking dates between two customers of the same room (when modifying or creating a new reservation)
- Dates falling outside the booking database limits
- Double booking of the same customer
Please read the 5 test cases of which cases 1-4 cover the above edge cases.
- nRooms = number of total Rooms
- nDays = number of Calendar days (per room)
- nBookedDays = number of days booked by the customer (<nDays) - (checkOutDate - checkInDate)
The 3 methods are
-
checkIfHotelBooked(): nRooms - since it has to search each room to see if it's booked or not.
-
checkReservationDates(): 2nDays + 2nBookedDays - since this method first extracts all the dates from the Calendar list, then checks if the checkinDate and checkOutDate falls within this list, along with getting their indices within the list. Obtaining these indices are important since then the second operation (+ nBookedDays) goes directly to the section of the calendar between the check-in/out dates. The second iteration of nBookedDays checks if the ID is 'none' or assigned to a customer ID. Each of these days has to be checked. NOTE: To see if the check
-
bookCustomer(): nBookedDays - this method assigns the customer ID to the section of the calendar within the check-in/out dates, to each booked day. Since it is called after checkReservationDates(), there is no need to check again if the ID assigned to the room date is 'none' prior to booking. If this check was added here, the complexity would be 2*nBookedDays. The reservation flag inside checkReservationDates() value tells the makeReservation() method if the dates fall within the range and if there is no active booking present simultaneously.