Professional Documents
Culture Documents
Submitted By:
Arshita Tyagi 9919102039
Rachit 9919102044
Rijish Ahuja 9919102049
Tanishq Singhal 99191020
1|Page
A typical luxury Hotel requires a management system to control its various operations such
as maintaining account of all the people in its domain of services, attending to various needs
of customers and also achieving increased efficiency in the overall working of the Hotel
itself.
Talking about the features of the Hotel Management System, the user can easily book a
room by providing room number, name, Room Type like Ac and Non-Ac. The user can also
search for the customer’s detail from their room numbers. He/she can check the total
rooms allotted which shows room numbers, customer’s name, their addresses, and phone
numbers. All the stored records can be modified and deleted. The last feature of this mini
project is about payments. By entering the room number, the system displays the total bill
of the customer.
The platform used is C++. Hence, we decided to use Code Blocks for optional coding and
easy debugging, we used Code Blocks Version-20.03 and made explicit .cpp files. Henceforth
for optimal usage of such software a windows-based operating system preferably Windows
10 must be there. Also, on the hardware part any system having Windows 10 installed will
suffice.
2|Page
Interface Design
3|Page
Fig: Leave a Room
4|Page
Fig: To know the availability of a Particular Room (Details of Customer cannot be shown)
5|Page
We have used Self Balancing Splay Tree and Stack Data Structures to make this software.
newRecord->right = nullRecord;
newRecord->room_num = room_num;
newRecord->cus_name = cus_name;
newRecord->no_of_days = no_of_days;
newRecord->room_type = room_type;
if (root == nullRecord)
root = newRecord;
else
splay(room_num,root);
6|Page
newRecord->left = root->left; newRecord->right
= root; root->left = nullRecord;
root = newRecord;
root = newRecord;
else
return;
cout << "\nYour Room is successfully Booked!! Have a Happy Stay :) \n";
node header;
7|Page
if (room_num < t->left->room_num)
rotate_with_left_child(t);
if (t->left == nullRecord)
break;
rightTreeMin->left = t;
rightTreeMin = t; t = t->left;
rotate_with_right_child(t);
if (t->right == nullRecord)
break;
leftTreeMax->right = t;
leftTreeMax = t;
t = t->right;
else
break;
leftTreeMax->right = t->left;
rightTreeMin->left = t->right;
t->left = header.right; t-
>right = header.left;
8|Page
}
//
k2;
k2 = k1;
k2 = k1;
//
Stack Implementation:
//
(Is_Empty())
9|Page
cout << "\nZero records !!\n";
return;
TEMP_Stk.push(root);
while (TEMP_Stk.size() != 0)
TEMP_Stk.pop();
if (temp->count > 0)
Frequents.push_back(temp);
sort(Frequents);
if (temp->right != nullRecord)
TEMP_Stk.push(temp->right);
if (temp->left != nullRecord)
TEMP_Stk.push(temp->left);
if (Frequents.size() == 0)
return;
10 | P a g e
cout << "Customer Name : " << Frequents[i]->cus_name << endl;
cout << "Room number : " << Frequents[i]->room_num << endl; cout << "Search
<< endl;
Frequents[i + 1] = Frequents[i];
i--;
Frequents[i + 1] = last;
if (n == nullRecord)
return false;
string t = n->cus_name;
if (t.compare(str) == 0)
return true;
11 | P a g e
return name_found(n->left, str) || name_found(n->right, str);
if (root == nullRecord)
return false;
if (n == nullRecord)
return;
string s = n->cus_name;
if (s.compare(search_string) == 0)
cout << n->cus_name << "\t\t\t" << n->room_num << "\t\t\t" << n-
>room_type << "\t\t\t" << n->no_of_days << endl;
n->count++;
>right, search_string);
//
12 | P a g e
COMPLETE CODE:
#include <iostream>
#include <vector>
#include <string>
#include <iostream>
#include <iomanip>
#include <stack>
#include <cstdio>
#include <bits/stdc++.h>
class Room
struct node
node()
count = 0;
};
public:
Room();
~Room();
Book_Room(int,string,int,string);
13 | P a g e
void rotate_with_left_child(node *&); void
void Calc_amount(string,int);
};
int accept_room_num();
string accept_cus_name();
int accept_no_of_days();
string accept_type();
int main()
Room rm;
int ch;
do
cout << "\n1. Book a Room\n"; cout << "2. Leave a Room\n"; cout << "3.
Display the Rooms Booked Information\n"; cout << "4. Check the
n"; cout << "7. Find the cost of Room\n"; cout <<
>> ch;
switch (ch)
case 1:
14 | P a g e
string cus_name, room_type; string
no_of_days =accept_no_of_days();
rm.Book_Room(room_num,cus_name,no_of_days,room_type);
cin>>pay_amt_ch;
if(pay_amt_ch == cho){
rm.Calc_amount(room_type,no_of_days);
else{
cout<<"\nThanks for booking the Room, You can Pay amount Later!\n";
break;
case 2:
int room_num;
room_num = accept_room_num();
rm.Leave_room(room_num);
cout << "\nYou left the room successfully! \n Thanks for Visiting!!\n";
break;
case 3:
rm.count = 0; if
(rm.Is_Empty())
break;
rm.Display_Rooms(rm.root);
15 | P a g e
cout << endl;
break;
case 4:
int room_num;
room_num = accept_room_num();
rm.search_Room(room_num);
break;
case 5:
string search_name;
search_name = accept_cus_name();
if (!rm.name_found(search_name))
cout << "\nThere are no records with customer name " << search_name << endl;
else
rm.search_by_name(search_name);
break;
case 6:
rm.Frequent_keys();
break;
16 | P a g e
}
case 7:
string room_type=accept_type();
rm.Calc_amount(room_type,no_of_days);
break;
return 0;
int accept_room_num()
int room_num;
<< "Enter the Room number you want : "; cin >> room_num;
return room_num;
string accept_cus_name()
string cus_name;
return cus_name;
string accept_type(){
17 | P a g e
string room_type; cout<<endl<<"Enter
int accept_no_of_days(){
Room :: Room()
root = nullRecord;
Room ::~Room()
Make_Empty(root);
delete root;
cus_name; newRecord->no_of_days =
if (root == nullRecord)
root = newRecord;
18 | P a g e
else
splay(room_num,root);
newRecord->left = root-
root->left = nullRecord;
root = newRecord;
newRecord->right = root-
root->right = nullRecord;
root = newRecord;
else
return;
cout << "\nYour Room is successfully Booked!! Have a Happy Stay :) \n";
node header;
nullRecord->room_num = room_num;
while (1)
19 | P a g e
if (room_num < t->left->room_num)
rotate_with_left_child(t);
if (t->left == nullRecord)
break;
rightTreeMin->left =
t; rightTreeMin = t;
t = t->left;
rotate_with_right_child(t);
if (t->right == nullRecord)
break;
leftTreeMax->right =
t; leftTreeMax = t;
t = t->right;
else
break;
leftTreeMax->right = t->left;
rightTreeMin->left = t->right;
t->left = header.right;
t->right = header.left;
20 | P a g e
node *k1 = k2->left; k2-
k2 = k1;
k2 = k1;
contains(room_num))
cout << room_num << " is not present Please enter your Correct Room Number!!\n\n";
return;
if (root->right == nullRecord)
newTree = root->left;
else
newTree = root->right;
splay(room_num, newTree);
newTree->left = root->left;
newTree;
21 | P a g e
splay(room_num, root);
while (t != nullRecord)
Leave_room(t->room_num);
int Room::count = 0;
if (t == NULL)
return;
cout << "Customer Name\t\t\tRoom number\t\t\tRoom Type\t\t\tNo Of Days Stay" << endl;
print(t);
n"; }
if (t != t->left)
22 | P a g e
print(t->left);
print(t->right);
if (!contains(room_num))
cout << room_num << " is not Not booked yet! Is available for Booking !!!\n";
return;
n"; cout << "Customer Name : " << root->cus_name << endl;
root->count++;
float non_ac=500,ac=1000,total_amt;
if(room_type=="Non_AC")
{ total_amt=non_ac*no_of_days;
else{
total_amt=ac*no_of_days;
(Is_Empty())
23 | P a g e
{
return;
TEMP_Stk.push(root);
while (TEMP_Stk.size() != 0)
TEMP_Stk.pop();
if (temp->count > 0)
Frequents.push_back(temp);
sort(Frequents);
if (temp->right != nullRecord)
TEMP_Stk.push(temp->right);
if (temp->left != nullRecord)
TEMP_Stk.push(temp->left);
if (Frequents.size() == 0)
return;
<< endl;
24 | P a g e
void Room ::sort(vector<node *> &Frequents)
Frequents[i + 1] = Frequents[i];
i--;
Frequents[i + 1] = last;
if (n == nullRecord)
return false;
string t = n->cus_name;
if (t.compare(str) == 0)
return true;
if (root == nullRecord)
return false;
25 | P a g e
{
if (n == nullRecord)
return;
string s = n->cus_name;
if (s.compare(search_string) == 0)
cout << n->cus_name << "\t\t\t" << n->room_num << "\t\t\t" << n->room_type << "\t\t\t" << n->no_of_days << endl;
n->count++;
>right, search_string);
search_by_name(root, search_name);
• https://www.geeksforgeeks.org/stack-data-structure-introduction-program/
• https://www.geeksforgeeks.org/splay-tree-set-1-insert/
• https://www.cs.bham.ac.uk/~jxb/DSA/dsa.pdf
• https://www.programiz.com/dsa/stack
26 | P a g e