problemmediumood

Object-Oriented Design for a Hotel Management System

Design a Hotel Management System

Let's design a Hotel Management System

We'll cover the following:

A Hotel Management System is a software built to handle all online hotel activities easily and safely. This System will give the hotel management power and flexibility to manage the entire system from a single online portal. The system allows the manager to keep track of all the available rooms in the system as well as to book rooms and generate bills.

Hotel Management System

Hotel Management System

System Requirements

We’ll focus on the following set of requirements while designing the Hotel Management System:

  1. The system should support the booking of different room types like standard, deluxe, family suite, etc.
  2. Guests should be able to search the room inventory and book any available room.
  3. The system should be able to retrieve information, such as who booked a particular room, or what rooms were booked by a specific customer.
  4. The system should allow customers to cancel their booking - and provide them with a full refund if the cancelation occurs before 24 hours of the check-in date.
  5. The system should be able to send notifications whenever the booking is nearing the check-in or check-out date.
  6. The system should maintain a room housekeeping log to keep track of all housekeeping tasks.
  7. Any customer should be able to add room services and food items.
  8. Customers can ask for different amenities.
  9. The customers should be able to pay their bills through credit card, check or cash.

Use Case Diagram

Here are the main Actors in our system:

  • Guest: All guests can search the available rooms, as well as make a booking.
  • Receptionist: Mainly responsible for adding and modifying rooms, creating room bookings, check-in, and check-out customers.
  • System: Mainly responsible for sending notifications for room booking, cancellation, etc.
  • Manager: Mainly responsible for adding new workers.
  • Housekeeper: To add/modify housekeeping record of rooms.
  • Server: To add/modify room service record of rooms.

Here are the top use cases of the Hotel Management System:

  • Add/Remove/Edit room: To add, remove, or modify a room in the system.
  • Search room: To search for rooms by type and availability.
  • Register or cancel an account: To add a new member or cancel the membership of an existing member.
  • Book room: To book a room.
  • Check-in: To let the guest check-in for their booking.
  • Check-out: To track the end of the booking and the return of the room keys.
  • Add room charge: To add a room service charge to the customer’s bill.
  • Update housekeeping log: To add or update the housekeeping entry of a room.

Here is the use case diagram of our Hotel Management System:

Hotel Management System Use Case Diagram

Use Case Diagram for Hotel Management System

Class Diagram

Here are the main classes of our Hotel Management System:

  • Hotel and HotelLocation: Our system will support multiple locations of a hotel.
  • Room: The basic building block of the system. Every room will be uniquely identified by the room number. Each Room will have attributes like Room Style, Booking Price, etc.
  • Account: We will have different types of accounts in the system: one will be a guest to search and book rooms, another will be a receptionist. Housekeeping will keep track of the housekeeping records of a room, and a Server will handle room service.

Problem

Design a Hotel Management System to manage room inventory, bookings, check-in/check-out, housekeeping, room services, billing, and notifications. The system should support different room types, multiple locations, and standard payment/refund rules.

Hotel Management System

Solution

1. Requirements Analysis

Functional Requirements:

  • Search and book rooms of various types (standard, deluxe, family suite, etc.).
  • Support booking lifecycle: create, modify, cancel (with refund rules).
  • Check-in / check-out flows and room key assignment.
  • Track housekeeping logs and room service charges.
  • Support invoice generation and multiple payment methods.
  • Notify guests about upcoming check-ins/check-outs and booking changes.

Non-Functional Requirements:

  • Consistency for booking and payment transactions.
  • Scalability across locations (hotel chains / multiple properties).
  • Durability for invoices, bookings and housekeeping logs.

Assumptions:

  • Cancellation refund policy: full refund if canceled >24 hours before check-in.

2. Use Case Diagram

Actors: Guest, Receptionist, Manager, Housekeeper, Server, System

Primary Use Cases: Search Room, Book Room, Check-in, Check-out, Add Room Charge, Update Housekeeping

graph TD
    subgraph HotelSystem
        UC1(Search Room)
        UC2(Book Room)
        UC3(Check-in)
        UC4(Check-out)
        UC5(Add Room Charge)
        UC6(Update Housekeeping)
    end
    Guest --> UC1
    Guest --> UC2
    Receptionist --> UC3
    Receptionist --> UC4
    Server --> UC5
    Housekeeper --> UC6
    System --> UC1

Hotel Management System Use Case Diagram

3. Class Diagram

Key classes and responsibilities:

  • Hotel / HotelLocation: top-level grouping of rooms and operations per location.
  • Room: represents a physical room with style, status, pricing, and keys.
  • RoomBooking: reservation and lifecycle details.
  • Account / Guest / Receptionist: actors with role-specific operations.
  • RoomCharge / Invoice: charges and billing line items.
  • RoomHouseKeeping: housekeeping entries and schedules.
classDiagram
    class Hotel { +String name +List~HotelLocation~ locations }
    class HotelLocation { +String name +Address address }
    class Room { +int roomNumber +RoomStyle style +RoomStatus status }
    class RoomBooking { +String reservationNumber +BookingStatus status }
    class Account { +UUID id +AccountStatus status }
    class RoomCharge { +float amount +String description }

    Hotel "1" -- "1..*" HotelLocation : has
    HotelLocation "1" -- "1..*" Room : contains
    Room "1" o-- "*" RoomBooking : bookings
    RoomBooking "1" o-- "*" RoomCharge : charges
    Account "1" o-- "*" RoomBooking : makes

Hotel Management System Class Diagram

4. Activity Diagrams

Activity: Make a Room Booking

graph TD
    A[Guest searches availability] --> B[Selects room and dates]
    B --> C[Create booking & hold room]
    C --> D[Process payment or hold funds]
    D --> E[Send confirmation & schedule housekeeping]

Hotel Management System Room Booking

Activity: Check-in

graph TD
    A[Guest arrives] --> B[Verify booking & ID]
    B --> C[Assign room key]
    C --> D[Update booking status to CHECKED_IN]
    D --> E[Schedule housekeeping after checkout]

Hotel Management System Check in

5. High-Level Code Implementation

Short Python and Java skeletons capturing the main types and method signatures.

Python (skeleton)

from enum import Enum
from typing import List


class RoomStyle(Enum):
    STANDARD = 1
    DELUXE = 2
    FAMILY_SUITE = 3
    BUSINESS_SUITE = 4


class RoomStatus(Enum):
    AVAILABLE = 1
    RESERVED = 2
    OCCUPIED = 3


class Room:
    def __init__(self, room_number: int, style: RoomStyle, price: float):
        self._room_number = room_number
        self._style = style
        self._price = price
        self._status = RoomStatus.AVAILABLE

    def is_available(self) -> bool:
        return self._status == RoomStatus.AVAILABLE


class RoomBooking:
    def __init__(self, reservation_number: str, guest_id: str, start_date, duration_days: int):
        self.reservation_number = reservation_number
        self.guest_id = guest_id
        self.start_date = start_date
        self.duration_days = duration_days
        self.status = None


class Hotel:
    def __init__(self, name: str):
        self._name = name
        self._locations = []

    def add_location(self, location):
        pass


class BookingService:
    def create_booking(self, guest_id: str, room_style: RoomStyle, start_date, duration: int) -> RoomBooking:
        pass

Java (skeleton)

public enum RoomStatus { AVAILABLE, RESERVED, OCCUPIED }

public class Room {
    private int roomNumber;
    private RoomStatus status;
}

public class RoomBooking {
    private String reservationNumber;
    private BookingStatus status;
}

public class BookingService {
    public RoomBooking createBooking(String guestId, RoomStyle style, Date start, int duration) { return null; }
}

Appendix — Original code

The original detailed examples (enums, Account/Person, Room, RoomBooking, RoomCharge) are preserved below for reference and for use when turning this note into a runnable demo or tests.

from enum import Enum


class RoomStyle(Enum):
    STANDARD, DELUXE, FAMILY_SUITE, BUSINESS_SUITE = 1, 2, 3, 4


class RoomStatus(Enum):
    AVAILABLE, RESERVED, OCCUPIED, NOT_AVAILABLE, BEING_SERVICED, OTHER = 1, 2, 3, 4, 5, 6


class BookingStatus(Enum):
    REQUESTED, PENDING, CONFIRMED, CHECKED_IN, CHECKED_OUT, CANCELLED, ABANDONED = 1, 2, 3, 4, 5, 6, 7


class AccountStatus(Enum):
    ACTIVE, CLOSED, CANCELED, BLACKLISTED, BLOCKED = 1, 2, 3, 4, 5


class AccountType(Enum):
    MEMBER, GUEST, MANAGER, RECEPTIONIST = 1, 2, 3, 4


class PaymentStatus(Enum):
    UNPAID, PENDING, COMPLETED, FILLED, DECLINED, CANCELLED, ABANDONED, SETTLING, SETTLED, REFUNDED = 1, 2, 3, 4, 5, 6, 7, 8, 9, 10


class Address:
    def __init__(self, street, city, state, zip_code, country):
        self.__street_address = street
        self.__city = city
        self.__state = state
        self.__zip_code = zip_code
        self.__country = country


from abc import ABC
from .constants import *


# For simplicity, we are not defining getter and setter functions. The reader can
# assume that all class attributes are private and accessed through their respective
# public getter methods and modified only through their public methods function.

class Account:
    def __init__(self, id, password, status=AccountStatus.Active):
        self.__id = id
        self.__password = password
        self.__status = status

    def reset_password(self):
        None


# from abc import ABC, abstractmethod
class Person(ABC):
    def __init__(self, name, address, email, phone, account):
        self.__name = name
        self.__address = address
        self.__email = email
        self.__phone = phone
        self.__account = account


class Guest(Person):
    def __init__(self):
        self.__total_rooms_checked_in = 0

    def get_bookings(self):
        None


class Receptionist(Person):
    def search_member(self, name):
        None

    def create_booking(self):
        None


class Server(Person):
    def add_room_charge(self, room, room_charge):
        None


class HotelLocation:
    def __init__(self, name, address):
        self.__name = name
        self.__location = address

    def get_rooms(self):
        None


class Hotel:
    def __init__(self, name):
        self.__name = name
        self.__locations = []

    def add_location(self, location):
        None


from datetime import datetime
from abc import ABC


class Search(ABC):
    def search(self, style, start_date, duration):
        None


class Room(Search):
    def __init__(self, room_number, room_style, status, price, is_smoking):
        self.__room_number = room_number
        self.__style = room_style
        self.__status = status
        self.__booking_price = price
        self.__is_smoking = is_smoking

        self.__keys = []
        self.__house_keeping_log = []

    def is_room_available(self):
        None

    def check_in(self):
        None

    def check_out(self):
        None

    def search(self, style, start_date, duration):
        None


class RoomKey:
    def __init__(self, key_id, barcode, is_active, is_master):
        self.__key_id = key_id
        self.__barcode = barcode
        self.__issued_at = datetime.date.today()
        self.__active = is_active
        self.__is_master = is_master

    def assign_room(self, room):
        None

    def is_active(self):
        None


class RoomHouseKeeping:
    def __init__(self, description, duration, house_keeper):
        self.__description = description
        self.__start_datetime = datetime.date.today()
        self.__duration = duration
        self.__house_keeper = house_keeper

    def add_house_keeping(self, room):
        None


class RoomBooking:
    def __init__(self, reservation_number, start_date, duration_in_days, booking_status):
        self.__reservation_number = reservation_number
        self.__start_date = start_date
        self.__duration_in_days = duration_in_days
        self.__status = booking_status
        self.__checkin = None
        self.__checkout = None

        self.__guest_id = 0
        self.__room = None
        self.__invoice = None
        self.__notifications = []

    def fetch_details(self, reservation_number):
        None


# from abc import ABC, abstractmethod
class RoomCharge(ABC):
    def __init__(self):
        self.__issue_at = datetime.date.today()

    def add_invoice_item(self, invoice):
        None


class Amenity(RoomCharge):
    def __init__(self, name, description):
        self.__name = name
        self.__description = description


class RoomService(RoomCharge):
    def __init__(self, is_chargeable, request_time):
        self.__is_chargeable = is_chargeable
        self.__request_time = request_time


class KitchenService(RoomCharge):
    def __init__(self, description):
        self.__description = description


Comments