Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
8 views4 pages

Dsa Project Documentation

The Galaxy Hotel Management System is a C++ program that efficiently manages hotel rooms and booking history using a binary search tree and a priority queue. Key features include room management, booking management, and maintaining a booking history with priority handling. The system provides a menu-driven interface for users to interact with functionalities such as displaying available rooms, booking, and canceling reservations.

Uploaded by

hamzaazizug98
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views4 pages

Dsa Project Documentation

The Galaxy Hotel Management System is a C++ program that efficiently manages hotel rooms and booking history using a binary search tree and a priority queue. Key features include room management, booking management, and maintaining a booking history with priority handling. The system provides a menu-driven interface for users to interact with functionalities such as displaying available rooms, booking, and canceling reservations.

Uploaded by

hamzaazizug98
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

TITLE: Data Structures and Algorithms (Lab)

Subject: FINAL PROJECT

ID: F2023266755, F2023266799, F2023266205

Section: V10

Submitted to: Sir Awais Amin

Submitted by: Ayesha Qadeer, Fatima Mukhtar, Muhammad Hamza Aziz

FINAL PROJECT DOCUMENTAION

GALAXY HOTEL MANAGEMENT SYSTEM

Overview

The Galaxy Hotel Management System is a C++ program designed to manage hotel rooms and booking
history efficiently. It utilizes a binary search tree (BST) to store and organize room details and a priority
queue to handle booking history based on customer priority. The program includes a menu-driven
interface for users to interact with the system.

Key Features

1. Room Management:

o Add rooms to the hotel with details such as ID, type, and status.
o Display available rooms in sorted order using an in-order traversal of the BST.

2. Booking Management:

o Book rooms based on customer preferences and room availability.

o Cancel bookings, starting with the highest-priority booking.

3. Booking History:

o Maintain a priority queue of bookings, ensuring that customers with higher priorities are
served first.

o Display all bookings with details such as customer name, room ID, and priority.

Components

1. Room Class

A Room object represents an individual hotel room. It serves as a node in the binary search tree.

 Attributes:

o roomID: Unique identifier for the room.

o type: Room type (Single, Double, Suite).

o status: Current status (Ready, Occupied, Booked, or Unavailable).

o left and right: Pointers to left and right child nodes in the BST.

 Constructor: Initializes the room details and sets child pointers to nullptr.

2. RoomTree Class

Manages the hotel rooms using a binary search tree (BST).

 Private Methods:

o insertRoom: Recursively inserts a room into the BST based on its roomID.

o searchRoom: Searches for a room by its ID.

o printRooms: Performs an in-order traversal to display rooms in ascending order of


roomID.

o deleteTree: Recursively deletes all nodes in the BST.

 Public Methods:

o insert: Wrapper for insertRoom to add a room.

o findRoom: Searches for a room using searchRoom.

o display: Calls printRooms to display all rooms.


o Destructor: Calls deleteTree to free allocated memory.

3. BookingHistory Class

Manages booking details using a priority queue.

 Inner Struct Booking: Represents an individual booking, containing:

o customerName: Name of the customer.

o roomID: The booked room's ID.

o priority: Booking priority (higher number indicates higher priority).

o Operator < is overridden to maintain a max-heap structure in the priority queue.

 Methods:

o recordBooking: Adds a booking to the priority queue.

o cancelBooking: Removes the booking with the highest priority.

o displayHistory: Displays all bookings sorted by priority.

4. Main Function

The main interface for interacting with the system.

 Functionality:

o Initializes the room tree with predefined rooms.

o Displays a menu with options:

1. Display Available Rooms: Shows rooms in sorted order based on roomID.

2. Book a Room: Allows users to book a room if it is "Ready".

3. Cancel Booking: Cancels the highest-priority booking in the queue.

4. Show Booking History: Displays all bookings, sorted by priority.

5. Exit: Terminates the program.

 Interactive Flow:

o Prompts the user to enter a choice.

o Executes the corresponding action based on the input.

o Continues until the user chooses to exit

Code Walkthrough
RoomTree Operations:

1. Insertion: Rooms are added to the binary search tree using hotel.insert. The roomID determines
the position in the tree.

2. Searching: Rooms are searched by ID using hotel.findRoom, which traverses the BST.

3. Display: hotel.display performs an in-order traversal, ensuring rooms are displayed in ascending
order of roomID.

Booking Management:

1. Booking a Room:

o Checks if the room exists and is "Ready".

o Marks the room as "Booked".

o Records the booking in the priority queue using history.recordBooking.

2. Cancelling a Booking:

o Removes the highest-priority booking from the queue using history.cancelBooking.

3. Displaying History:

o Displays all bookings, sorted by priority, using history.displayHistory.

You might also like