To help you design a hotel reservation system for a hotel in Abu Dhabi, we’ll break down the requirements into several tasks: identifying use cases, creating UML diagrams, defining classes, and implementing Python code.
1. Use Cases Identification
Use Case Scenarios
- Scenario 1: Online Reservation
- Use Case 1: Search Availability
- Use Case 2: Make Reservation
- Scenario 2: On-Site Reservation
- Use Case 1: Check Room Availability
- Use Case 2: Confirm Reservation
- Scenario 3: Cancel Reservation
- Use Case 1: Request Cancellation
- Use Case 2: Process Cancellation
UML Use Case Diagram
+----------------+
| Hotel System |
+----------------+
^
|
|
+---------------+ +-------------------+
| Customer |<---->| Reservation |
| | | |
+----------------+ +-------------------+
^ ^ ^
| | |
| | |
| | |
+----+ +----+ +-----+
|Search| |Check| |Cancel|
|Availability| |Availability| |
+-------------+ +------------+----+
^ ^
| |
| |
+----------------+ +------------------+
|Make Reservation| |Confirm Reservation|
+----------------+ +------------------+
Use Case Description Tables
Use Case ID |
Name |
Description |
Actors |
UC1 |
Search Availability |
Allows the customer to search for available rooms based on criteria. |
Customer |
UC2 |
Make Reservation |
Allows the customer to make a reservation online. |
Customer |
UC3 |
Check Room Availability |
Allows the customer to check room availability on-site. |
Customer |
UC4 |
Confirm Reservation |
Confirms the reservation made by the customer on-site. |
Customer |
UC5 |
Request Cancellation |
Allows the customer to request the cancellation of a reservation. |
Customer |
UC6 |
Process Cancellation |
Processes the cancellation request and updates the system. |
Hotel Staff |
2. UML Class Diagram
Identified Classes
- Customer
- Attributes:
customer_id
, name
, email
, phone_number
, reservation_list
- Reservation
- Attributes:
reservation_id
, customer
, room
, start_date
, end_date
- Room
- Attributes:
room_number
, room_type
, price
, availability_status
, amenities
- Hotel
- Attributes:
hotel_name
, location
, room_list
, reservation_list
, staff
UML Class Diagram
+---------------+
| Customer |
+---------------+
|- customer_id |
|- name |
|- email |
|- phone_number |
|- reservation_list |
+---------------+
|+ add_reservation()|
|+ cancel_reservation()|
+---------------+
+-----------------+
| Reservation |
+-----------------+
|- reservation_id |
|- customer |
|- room |
|- start_date |
|- end_date |
+-----------------+
|+ confirm() |
|+ cancel() |
+-----------------+
+-----------+
| Room |
+-----------+
|- room_number|
|- room_type |
|- price |
|- availability_status|
|- amenities |
+-----------+
|+ is_available()|
|+ book_room() |
+-----------+
+---------------+
| Hotel |
+---------------+
|- hotel_name |
|- location |
|- room_list |
|- reservation_list|
|- staff |
+---------------+
|+ check_availability()|
|+ add_room() |
+---------------+
Access Specifiers
- Public (
+
): Methods that can be accessed from outside the class.
- Private (
-
): Attributes that cannot be accessed directly from outside the class.
3. Python Classes Implementation
class Customer:
def __init__(self, customer_id, name, email, phone_number):
self.__customer_id = customer_id
self.__name = name
self.__email = email
self.__phone_number = phone_number
self.__reservation_list = []
def get_customer_id(self):
return self.__customer_id
def get_name(self):
return self.__name
def get_email(self):
return self.__email
def get_phone_number(self):
return self.__phone_number
def get_reservation_list(self):
return self.__reservation_list
def set_name(self, name):
self.__name = name
def add_reservation(self, reservation):
pass
def cancel_reservation(self, reservation_id):
pass
class Reservation:
def __init__(self, reservation_id, customer, room, start_date, end_date):
self.__reservation_id = reservation_id
self.__customer = customer
self.__room = room
self.__start_date = start_date
self.__end_date = end_date
def get_reservation_id(self):
return self.__reservation_id
def get_customer(self):
return self.__customer
def get_room(self):
return self.__room
def get_start_date(self):
return self.__start_date
def get_end_date(self):
return self.__end_date
def confirm(self):
pass
def cancel(self):
pass
class Room:
def __init__(self, room_number, room_type, price, availability_status, amenities):
self.__room_number = room_number
self.__room_type = room_type
self.__price = price
self.__availability_status = availability_status
self.__amenities = amenities
def get_room_number(self):
return self.__room_number
def get_room_type(self):
return self.__room_type
def get_price(self):
return self.__price
def get_availability_status(self):
return self.__availability_status
def get_amenities(self):
return self.__amenities
def is_available(self):
pass
def book_room(self):
pass
class Hotel:
def __init__(self, hotel_name, location):
self.__hotel_name = hotel_name
self.__location = location
self.__room_list = []
self.__reservation_list = []
self.__staff = []
def get_hotel_name(self):
return self.__hotel_name
def get_location(self):
return self.__location
def get_room_list(self):
return self.__room_list
def get_reservation_list(self):
return self.__reservation_list
def check_availability(self):
pass
def add_room(self, room):
pass
customer1 = Customer(1, "Ali Ahmed", "[email protected]", "+971501234567")
room1 = Room(101, "Deluxe", 300, True, ["Wi-Fi", "TV", "Mini Bar"])
reservation1 = Reservation(1001, customer1, room1, "2023-10-01", "2023-10-05")
hotel = Hotel("Abu Dhabi Grand Hotel", "Abu Dhabi")
print("Customer Name:", customer1.get_name())
print("Room Type:", room1.get_room_type())
print("Reservation ID:", reservation1.get_reservation_id())
print("Hotel Name:", hotel.get_hotel_name())
Summary
This design provides an overview of a hotel reservation system through use cases, UML diagrams, class definitions, and Python implementations. Each class encapsulates properties related to customers, reservations, rooms, and hotels while adhering to object-oriented principles such as encapsulation and modularity. The placeholders indicate areas for future functionality that would need to be implemented to make the system operational.