Hotel Management System - Mini Project
Hotel Management System - Mini Project
KAVARAIPETTAI
CHENNAI – 601206.
AISSCE – 2022-23
1
RMK RESIDENTIAL SENIOR SECONDARY SCHOOL
CERTIFICATE
Reg.No: ___________________
This is to certify that this is the Bona fide record of project work done by
Master/Miss.DUVVURU VAISHNAVI of Grade XII during the academic
year 2022-2023.
DATE: __________
2
TABLE OF CONTENTS
1. ACKNOWLEDGEMENT. 4
2. INTRODUCTION OF PYTHON. 5
3. INTRODUCTION TO DBMS. 6
4. INTRODUCTION TO SQL. 7
12. BIBLIOGRAPHY. 35
3
ACKNOWLEDGEMENT
successfully.
I am very thankful to my Computer Science teacher Mr. APPAN RAJ D for his
valuable guidance rendered which has sustained my efforts in all the stages of
I would also like to thank my parents for their continuous support and
encouragement.
Laboratory Admin Mr. Ravindar N for rendering their help in developing this
project and to the people who have willingly helped me with their abilities.
4
INTRODUCTION TO PYTHON
with dynamic semantics. Its high-level built-in data structures, combined with
dynamic typing and dynamic binding; make it very attractive for Rapid
program modularity and code reuse. The Python interpreter and the extensive
standard library are available in source or binary form without charge for all
History of Python:
initially designed by "Guido van Rossum" in 1991 and developed by Python Software
Foundation. It was mainly developed for emphasis on code readability, and its syntax
5
INTRODUCTION TO DATABASE
INTRODUCTION TO DBMS
Advantages of DBMS:
i. Data independence.
ii. Efficient data access.
iii. Data Integrity and Security.
6
INTRODUCTION TO SQL
o SQL stands for Structured Query Language. It is used for storing and managing
data in relational database management system (RDMS).
Characteristics of SQL:
SQL
7
Python MySQL Connector
It is a Python driver that helps to integrate Python and MySQL. This Python MySQL
library allows the conversion between Python and MySQL data types. MySQL Connector
API is implemented using pure Python and does not require any third-party library.
Installation
To install the mysql-connector-python module, one must have Python and PIP,
preinstalled on their system.
After Successful installation we must import python sql connector by using import
keyword.
Example: import mysql.connector
The connect statement creates a connection to the mysql server and returns a MySQL
connection object.
Syntax:
Example:
import mysql.connector
con=mysql.connector.connect(host="localhost", user="root", password="root")
8
Creating a cursor Object:
Example: Cursor=con.cursor()
The above code will execute the sql query and store the retrieved records (resultset) in
the cursor object(cursor).
The records retrieved from the database using SQL select query has to be extracted as
record from the result set. We can extract data from the result set using the following
fetch() function.
fetchone()-Fetches the next row of a query result set, returning a single sequence or
None when no more data is available
fetchmany (size)-Fetches the next set of rows of a query result, returning a sequence of
sequences. It will return number of rows that matches to the size
argument.
9
ABSTRACT
The hotel manager is a very busy person and does not have the time to sit and manage
the entire activities manually on paper. Hotel management project provides room
booking, staff management and other necessary hotel management features. The system
allows the manager to post available rooms in the system. Customers can view and book
rooms online. Other hotel services can also be viewed by the customers and can book
them too. The system is hence useful for both customers and managers to portable
Sometimes it happens that the rooms get booked soon when one visits the place
therefore users can make advance booking using this system. It saves the user time in
searching a room. The system is useful as it calculates an exact cost of rooms for
It saves organization resources and expenses. This system is effective and saves time and
cost of users. The aim of an automated hotel management system is to handle all aspects
10
EXISTING SYSTEM
The existing system of Hotel Management was manual. All the daily routines are carried
out manually and the records are maintained in the record books or the registers. The
customer used to make enquiry for rooms available, and then depending upon the status
he used to make booking. All the data the receptionist used to give the customer was
based on paper works, there was no clear idea of the status of rooms as they did not
update automatically.
The clerk operates the bill department he used to generate the bill of the customer
depending upon the services utilized by the customer. The inventory manager manages
the inventory as he checks the status of the inventory and as per that he places the
order.
PROPOSED SYSTEM
The proposed system is a hotel management system which will allow for staff to view
rooms that are available and highlight rooms that have already been booked. The scope
of the project is to create a booking management system, which will have features such
as highlighting booked rooms, searching certain rooms and filters allowing for staff to
book available rooms in a simplified manner while providing a foundation for
expandability with easy to read code where another programmer can implement
additional features.
11
HARDWARE AND SOFTWARE REQUIREMENTS
HARDWARE REQUIREMENTS:
RAM : 512MB+
Key board and mouse : Any Company keyboard and Optical Mouse
SOFTWARE REQUIREMENTS:
12
PROJECT AIM AND OBJECTIVES
The aim of this project is to develop an integrated Hotel Management System that both
administrators and customers can use. The admin will inform customers of the
availability of rooms in various hotels, and customers will verify the availability of rooms
in the desired hotel. Customers should be able to find out if a room in a particular hotel
is available.
Backend Details
Interfacing python with mysql we can store and retrieve data back easily.
Database Name:HOTEL
This table is used to store the details of RoomID, Type of Room, Status(whether it
is free or available),User Name, And Date of booking and it has the following
structure:
Field Name Data Type Remarks
RoomId Int Primary Key
TypeofRoom Varhcar(20)
Status Varhcar(10)
User Varchar(20)
DOB Date
13
(ii) Table Name : EMP
This table is used to store the details of Employees Such as Employee id, Name,
Age, Blood Group, Date of Birth and it has the following structure:
Field Name Data Type Remarks
EmpId Int Primary Key
Name Varhcar(20)
Age Int
BG Varchar(7)
DOB Date
This table is used to store the details of Booked users. It has the following
structure:
Field Name Data Type Remarks
UID Int Primary Key
ROOMID Int
TYPE Int
DAYS int
PRICE Int
DOE Date
14
FRONT END DETAILS
In this part, I would like to discuss various modules inside the project Hotel Management
System.
1. Main Menu:
The Main Menu contains three options.
Main Menu
Admin
User
Book
2. Admin Menu:
The Admin is the authorized after entering correct user name and password
he/she can to create database, to see the details of user and employees. This
module
Contains 4 options. They are:
Admin Menu
Create Database
Room
Employee
User
15
3. Room Menu:
The Room module will help to create New room details, display, search, modify
and delete room details. It contains the following sub modules.
Room Menu
Create Room
Display
Search_Room
Modify_Room
Delete_Room
4. Employee Menu:
The Employee module will help to create New Employee details, display, and
search, modify and delete Employee details. It contains the following sub modules.
Employee Menu
Create Employee
Display Employee
Search_Emp
Modify_Emp
Delete_Emp
5. BOOKMenu:
The Book module will help to Book the rooms for the users. If the user is successfully
booked their name and status of the room will be update in Room table.
16
SOURCE CODE
import mysql.connector
def Create_Database():
ch=input("Are you creating database first time(y/n):")
if ch=='y':
con=mysql.connector.connect(host='localhost', user='root', password='root')
if con.is_connected():
cur=con.cursor()
Q="CREATE DATABASE HOTEL"
cur.execute(Q)
Create_Table()
print("DATABASE AND TABLES ARE CREATED SUCCESSFULLY")
Main_Menu()
con.close()
def Create_Table():
con=mysql.connector.connect(host='localhost', user='root', password='root',
database="HOTEL")
if con.is_connected():
cur=con.cursor()
L="CREATE TABLE ROOM(RoomId int primary key, TypeofRoom varchar(10),Price
int,Status varchar(15),User varchar(20),DOB Date)"
S="CREATE TABLE EMP(EMPID INT PRIMARY KEY,NAME VARCHAR(20),AGE\
INT,BG VARCHAR(6),DOB DATE)"
K="CREATE TABLE USER(UID INT PRIMARY KEY, USERNAME VARCHAR(30),\
AGE INT,GENDER VARCHAR(7),AADHAR INT,\
MOBILE VARCHAR(20),EMAIL VARCHAR(35),\
ORIGIN VARCHAR(15))"
T="CREATE TABLE BOOK(UID INT PRIMARY KEY, ROOMID INT,\
TYPE VARCHAR(5),DAYS INT,PRICE INT,DOE DATE)"
cur.execute(L)
cur.execute(S)
cur.execute(K)
cur.execute(T)
con.close()
17
def Main_Menu():
print("\n")
print("1.Admin")
print("2.User")
print("3.Book")
ch=int(input("Enter Your Choice:"))
if ch==1:
Admin()
elif ch==2:
Users()
elif ch==3:
Book()
def Admin():
print("*"*30)
print("WELCOME TO ADMIN MENU")
print("*"*30)
user=input("Enter Your Username:")
pwd=input("Enter Your password:")
if user=='admin' and pwd=='admin@123':
print("1. Create New Database")
print("2. Room")
print("3. Employee")
print("4. User")
ch=int(input("Enter your choice:"))
if ch==1:
Create_Database()
elif ch==2:
Room()
elif ch==3:
Emp()
elif ch==4:
User()
else:
print("Username/Password is wrong")
18
def Room():
print("*"*30)
print("WELCOME TO ROOM MENU")
print("*"*30)
print("1.Add Room")
print("2.Display Room")
print("3.Search Room")
print("4.Modify Room")
print("5.Delete Room")
l=int(input("Enter your choice:"))
if l==1:
Add_Room()
elif l==2:
Display_Room()
elif l==3:
Search_Room()
elif l==4:
Modify_Room()
elif l==5:
Del_Room()
else:
print("The Choice is Wrong")
def Add_Room(User='NULL',DOE='2000-01-01'):
print("*"*30)
print("WELCOME TO ADD CREATION MENU")
print("*"*30)
con=mysql.connector.connect(host='localhost', user='root',
password='root',database='HOTEL')
if con.is_connected():
cur=con.cursor()
A=int(input("Enter Room No:"))
B=input("Type of Room(AC(A)/NON-AC(NA)):")
if B=='A':
Price=1000
19
elif B=='NA':
Price=700
S=input("Enter the status of the room")
if S=='Free':
Q="INSERT INTO ROOM VALUES({},'{}',{},'{}','{}','{}')".format(A,B,Price,S,User,DOE)
cur.execute(Q)
else:
Q="INSERT INTO ROOM VALUES({},'{}',{},'{}','{}','{}')".format(A,B,Price,S,User,DOE)
cur.execute(Q)
con.commit()
con.close()
Main_Menu()
def Display_Room():
print("*"*30)
print("WELCOME TO ROOMS DISPLAY MENU")
print("*"*30)
con=mysql.connector.connect(host='localhost', user='root',
password='root',database='HOTEL')
if con.is_connected():
cur=con.cursor()
N="SELECT * FROM ROOM"
cur.execute(N)
D=cur.fetchall()
for i in D:
print(i)
con.commit()
con.close()
Main_Menu()
def Search_Room():
print("*"*30)
print("WELCOME TO ROOM SEARCH MENU")
print("*"*30)
con=mysql.connector.connect(host='localhost', user='root',
password='root',database='HOTEL')
20
if con.is_connected():
cur=con.cursor()
print("1. Search based on Room no:")
print("2. Search based on Room type:")
ch=int(input("Enter Your choice:"))
if ch==1:
no=int(input("Enter the room number you want to search"))
Q="SELECT * FROM ROOM WHERE ROOMID={}".format(no)
cur.execute(Q)
K=cur.fetchall()
for i in K:
print(i)
if ch==2:
types=input("Enter the type of room")
N="SELECT * FROM ROOM WHERE TYPEOFROOM='{}'".format(types)
cur.execute(N)
T=cur.fetchall()
for i in T:
print(i)
con.close()
Main_Menu()
def Modify_Room():
print("*"*30)
print("WELCOME TO ROOM MODIFY MENU")
print("*"*30)
con=mysql.connector.connect(host='localhost', user='root',
password='root',database='HOTEL')
if con.is_connected():
cur=con.cursor()
print("1.Type of Room")
chs=int(input("Enter your choice:"))
if chs==1:
K=int(input("Enter the room id:"))
W=input("Enter the type of room you want to modify to:")
C=int(input("Enter the cost of the room:"))
21
r="UPDATE ROOM SET TYPEOFROOM='{}'WHERE ROOMID={}".format(W,K)
s="UPDATE ROOM SET PRICE={} WHERE ROOMID={}".format(C,K)
cur.execute(r)
cur.execute(s)
con.commit()
con.close()
Main_Menu()
def Del_Room():
print("*"*30)
print("WELCOME TO ROOM DETAILS DELETION MENU")
print("*"*30)
con=mysql.connector.connect(host='localhost', user='root',
password='root',database='HOTEL')
if con.is_connected():
cur=con.cursor()
a=int(input("Enter room id:"))
U="DELETE FROM ROOM WHERE ROOMID={}".format(a)
cur.execute(U)
con.commit()
con.close()
Main_Menu()
def Emp():
print("*"*30)
print("WELCOME TO EMPLOYEE MENU")
print("*"*30)
print("1.Add Employee")
print("2.Display Employee")
print("3.Search Employee")
print('4.Modify Employee')
print("5.Delete Employee")
e=int(input("Enter your choice:"))
if e==1:
add_emp()
elif e==2:
disp_emp()
22
elif e==3:
search_emp()
elif e==4:
mod_emp()
elif e==4:
del_emp()
else:
print("Invalid Choice")
def add_emp():
print("*"*30)
print("WELCOME TO EMPLOYEE DETAILS REGISTRATION MENU")
print("*"*30)
con=mysql.connector.connect(host='localhost', user='root',
password='root',database='HOTEL')
if con.is_connected():
cur=con.cursor()
A=int(input("Enter emp id:"))
B=input("Enter emp name:")
C=int(input("Enter emp age:"))
D=input("Enter emp blood group")
DOB=input("Enter Date of Join:")
Q="INSERT INTO EMP VALUES({},'{}',{},'{}','{}')".format(A,B,C,D,DOB)
cur.execute(Q)
con.commit()
con.close()
Main_Menu()
def disp_emp():
print("*"*30)
print("WELCOME TO EMPLOYEE DISPLAY MENU")
print("*"*30)
con=mysql.connector.connect(host='localhost', user='root',
password='root',database='HOTEL')
if con.is_connected():
cur=con.cursor()
N="SELECT * FROM EMP"
cur.execute(N)
23
D=cur.fetchall()
for i in D:
print(i)
con.close()
Main_Menu()
def search_emp():
print("*"*30)
print("WELCOME TO EMPLOYEE SEARCH MENU")
print("*"*30)
con=mysql.connector.connect(host='localhost', user='root',
password='root',database='HOTEL')
if con.is_connected():
cur=con.cursor()
print("1. Search based on emp id:")
print("2. Search based on emp name:")
ch=int(input("Enter Your choice:"))
if ch==1:
no=int(input("Enter the empid you want to search"))
Q="SELECT * FROM ROOM WHERE EMPID={}".format(no)
cur.execute(Q)
K=cur.fetchall()
for i in K:
print(i)
if ch==2:
types=input("Enter the emp name")
N="SELECT * FROM ROOM WHERE NAME='{}'".format(types)
cur.execute(N)
T=cur.fetchall()
for i in T:
print(i)
con.close()
Main_Menu()
24
def mod_emp():
print("*"*30)
print("WELCOME TO EMPLOYEE MODIFICATION MENU")
print("*"*30)
con=mysql.connector.connect(host='localhost', user='root',
password='root',database='HOTEL')
if con.is_connected():
cur=con.cursor()
print("1.Name of the emp")
print("2.Age of the emp")
print("3.Blood Group of the emp")
CHS=int(input("Enter your choice:"))
if CHS==1:
A=input("Enter the modified name:")
r="UPDATE EMP SET NAME='{}'".format(A)
cur.execute(r)
con.commit()
elif CHS==2:
B=int(input("Enter the modified age:"))
b="UPDATE EMP SET AGE={}".format(B)
cur.execute(b)
con.commit()
elif CHS==3:
C=input("Enter the modified blood group")
c="UPDATE EMP SET BG='{}'".format(C)
cur.execute(c)
con.commit()
else:
print("Invalid Option")
con.close()
Main_Menu()
25
def del_emp():
print("*"*30)
print("WELCOME TO EMPLOYEE DETAILS DELETION MENU")
print("*"*30)
con=mysql.connector.connect(host='localhost', user='root',
password='root',database='HOTEL')
if con.is_connected():
cur=con.cursor()
a=int(input("Enter emp id:"))
U="DELETE FROM EMP WHERE EMPID={}".format(a)
cur.execute(U)
con.commit()
con.close()
Main_Menu()
def Users():
print("*"*30)
print("WELCOME TO USER MENU")
print("*"*30)
print("1.Create User")
print("2.Display all users")
print("3.Search Users")
print("4.Modify user")
print("5.Delete User")
ch=int(input("Enter your choice:"))
if ch==1:
Create_User()
elif ch==2:
Disp_User()
elif ch==3:
Search_User()
elif ch==4:
Mod_User()
elif ch==5:
Del_User()
else:
print("Invalid Choice")
26
def Create_User():
print("*"*30)
print("WELCOME TO USER REGISTRATION")
print("*"*30)
con=mysql.connector.connect(host='localhost', user='root',
password='root',database='HOTEL')
if con.is_connected():
cur=con.cursor()
ID=int(input("Enter User Id:"))
Q="SELECT UID FROM USER"
cur.execute(Q)
D1=cur.fetchall()
if D1!=[] or D1[0]!=UID:
B=input("Enter User name:")
C=int(input("Enter Age:"))
D=input("Enter Gender:")
E=int(input("Enter Aadhar No:"))
F=int(input("Enter Mobile No:"))
G=input("Enter Email Id:")
H=input("Enter the place of origin")
Q="INSERT INTO USER VALUES({},'{}',{},'{}',{},{},'{}','{}')".format(ID,B,C,D,E,F,G,H)
cur.execute(Q)
mn=input("Do you want to book a room?(y/n)")
if mn=='y':
Book(ID)
elif mn=='n':
print("REGISTRATION IS SUCCESSFULL")
else:
print("Invalid Option")
con.commit()
print("User id is available")
con.close()
Main_Menu()
27
def Book(ID='NULL'):
print("*"*30)
print("WELCOME TO BOOKING")
print("*"*30)
con=mysql.connector.connect(host='localhost', user='root',
password='root',database='HOTEL')
if con.is_connected():
cur=con.cursor()
ID=int(input("Enter your User id:"))
Q1="SELECT UID FROM USER WHERE UID={}".format(ID)
cur.execute(Q1)
D1=cur.fetchall()
if D1!=[]:
if ID in D1[0]:
A=input("Enter the type of room you want AC(A)/Non-Ac(NA)?")
Q2="SELECT ROOMID,STATUS FROM ROOM WHERE\
TYPEOFROOM='{}'".format(A)
cur.execute(Q2)
D=cur.fetchall()
for i,j in D:
print(i,j)
RoomID=int(input("Enter the room id you prefer:"))
B=int(input("Enter the number of days:"))
K="SELECT PRICE FROM ROOM WHERE TYPEOFROOM='{}'".format(A)
cur.execute(K)
d=cur.fetchone()
Tot=B*d[0]
DOE=input("Enter the date of entry:")
Q3="INSERT INTO BOOK\
VALUES({},{},'{}',{},{},'{}')".format(ID,RoomID,A,B,Tot,DOE)
cur.execute(Q3)
Q4="UPDATE ROOM SET STATUS='BOOKED' WHERE
ROOMID={}".format(RoomID)
cur.execute(Q4)
con.commit()
print("Your Room is booked Successfully")
else:
print("User id is not available")
28
else:
print("Useres are not found")
con.close()
def Disp_User():
print("*"*30)
print("WELCOME TO USER DISPLAY MENU")
print("*"*30)
con=mysql.connector.connect(host='localhost', user='root', password='root',
database='HOTEL')
if con.is_connected():
cur=con.cursor()
N="SELECT * FROM USER"
cur.execute(N)
D=cur.fetchall()
for i in D:
print(i)
con.commit()
con.close()
Main_Menu()
def Search_User():
print("*"*30)
print("WELCOME TO USER SEARCH MENU")
print("*"*30)
con=mysql.connector.connect(host='localhost', user='root', password='root',
database='HOTEL')
if con.is_connected():
cur=con.cursor()
print("1. Search based on Userid:")
print("2. Search based on Username:")
ch=int(input("Enter Your choice:"))
if ch==1:
no=int(input("Enter the Userid you want to search"))
Q="SELECT * FROM USER WHERE UID={}".format(no)
cur.execute(Q)
K=cur.fetchall()
29
for i in K:
print(i)
eliif ch==2:
types=input("Enter the user name")
N="SELECT * FROM USER WHERE USERNAME='{}'".format(types)
cur.execute(N)
T=cur.fetchall()
for i in T:
print(i)
con.close()
Main_Menu()
def Mod_User():
print("*"*30)
print("WELCOME TO USER MODIFICATION MENU")
print("*"*30)
con=mysql.connector.connect(host='localhost', user='root', password='root',
database='HOTEL')
if con.is_connected():
cur=con.cursor()
print("1.Name of the User")
print("2.Age of the User")
print("3.Mobile No of the User")
print("4.Email Id of the User")
print("5.Place of origin")
wd=int(input("Enter your choice:"))
if wd==1:
A=input("Enter the modified name:")
r="UPDATE USER SET USERNAME='{}'".format(A)
cur.execute(r)
con.commit()
elif wd==2:
B=int(input("Enter the modified age:"))
b="UPDATE USER SET AGE={}".format(B)
cur.execute(b)
con.commit()
30
elif wd==3:
C=input("Enter the modified mobile number")
c="UPDATE USER SET MOBILE={}".format(C)
cur.execute(c)
con.commit()
elif wd==4:
D=input("Enter the modified email id")
d="UPDATE USER SET EMAIL='{}'".format(D)
cur.execute(d)
con.commit()
elif wd==5:
E=input("Enter the new place of origin")
e="UPDATE USER SET ORIGIN='{}'".format(E)
cur.execute(e)
con.commit()
else:
print("Invalid Option")
con.close()
Main_Menu()
def Del_User():
print("*"*30)
print("WELCOME TO USER DELETION MENU")
print("*"*30)
con=mysql.connector.connect(host='localhost', user='root',
password='root',database='HOTEL')
if con.is_connected():
cur=con.cursor()
a=int(input("Enter USER id:"))
U="DELETE FROM USER WHERE USERID={}".format(a)
cur.execute(U)
con.commit()
con.close()
Main_Menu()
#Main Program
print('*'*33)
print("WELCOME TO HOTEL MANAGEMENT SYSTEM")
print('*'*33)
Main_Menu()
31
SCREEN SHOTS OF THE PROJECT
1. Main Menu
2. ADMIN MENU
32
3. ADD ROOM / CREATE ROOM:
4. Display Room:
33
6. USER DISPLAY MENU:
8. BOOKING MENU:
***************************************************************************
34
BIBLIOGRAPHY
BOOKS:
WEBSITES:
www.geeksforgeeks.org
https://docs.python.org/3/
35