0% found this document useful (0 votes)
28 views35 pages

Hotel Management System - Mini Project

Uploaded by

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

Hotel Management System - Mini Project

Uploaded by

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

RMK RESIDENTIAL SENIOR SECONDARY SCHOOL

KAVARAIPETTAI
CHENNAI – 601206.

AISSCE – 2022-23

COMPUTER SCIENCE PROJECT

"HOTEL MANAGEMENT SYSTEM"

DEPARTMENT OF COMPUTER SCIENCE


2022 - 2023

1
RMK RESIDENTIAL SENIOR SECONDARY SCHOOL

COMPUTER SCIENCE PROJECT

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.

Submitted for AISSCE Computer Science Practical examination held on


______________________at RMK Residential Senior Secondary School,
Kavaraipettai, Chennai -601 206.

DATE: __________

PRINCIPAL INTERNAL EXAMINER EXTERNAL EXAMINER

2
TABLE OF CONTENTS

S.No DESCRIPTION PAGE NO

1. ACKNOWLEDGEMENT. 4

2. INTRODUCTION OF PYTHON. 5

3. INTRODUCTION TO DBMS. 6

4. INTRODUCTION TO SQL. 7

5. INTRODUCTION PYTHON SQL CONNECTOR. 8

6. ABSTRACT OF THE PROJECT. 10

7. EXISTING AND PROPOSED SYSTEM. 11

8. HARDWARE AND SOFTWARE REQUIREMENTS. 12

PROJECT AIM AND OBJECTIVES& BACK END, FRONT


9. 13
END DETAILS.

10. SOURCE CODE OF THE PROJECT. 17

11. SAMPLE OUTPUT /SCREEN SHOTS OF EXECUTION. 32

12. BIBLIOGRAPHY. 35

3
ACKNOWLEDGEMENT

I thank everyone who supported and helped me in completing this project

successfully.

I would like to thank my Principal Mrs. Sapna Sankhla and the

Academic coordinator Mrs. Sulekha and to the management for providing me

the facilities required to do my project.

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

this project work.

I would also like to thank my parents for their continuous support and

encouragement.

My thanks and appreciation to my friends and the Computer Science

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

Python is an interpreter, object-oriented, high-level programming language

with dynamic semantics. Its high-level built-in data structures, combined with

dynamic typing and dynamic binding; make it very attractive for Rapid

Application Development, as well as for use as a scripting or glue language to

connect existing components together. Python's simple, easy to learn syntax

emphasizes readability and therefore reduces the cost of program

maintenance. Python supports modules and packages, which encourages

program modularity and code reuse. The Python interpreter and the extensive

standard library are available in source or binary form without charge for all

major platforms, and can be freely distributed.

History of Python:

Python is a widely used general-purpose, high-level programming language. It was

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

allows programmers to express concepts in fewer lines of code.

5
INTRODUCTION TO DATABASE

Database is a collection of interrelated data which helps in the efficient retrieval,


insertion, and deletion of data from the database and organizes the data in the form of
tables.

INTRODUCTION TO DBMS

 It stands for "Database Management System".


 It refers to the technology for creating and managing databases. DBMS is a
software tool to organize (create, retrieve, update, and manage) data in a database.
 Example: Oracle, MySQL, MongoDB and Microsoft SQL server etc…

Why Use DBMS ?


 To develop software applications In less time.
 Data independence and efficient use of data.
 For uniform data administration.
 For data integrity and security.
 For concurrent access to data, and data recovery from crashes.
 To use user-friendly declarative query language.

Advantages of DBMS:
i. Data independence.
ii. Efficient data access.
iii. Data Integrity and Security.

Components of Database Applications:

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).

o It is a standard language for Relational Database System. It enables a user to


create, read, update and delete relational databases and tables.

Characteristics of SQL:

 SQL is easy to learn.


 SQL is used to access data from relational database management systems.
 SQL can execute queries against the database.
 SQL is used to describe the data.
 SQL is used to define the data in the database and manipulate it when needed.
 SQL is used to create and drop the database and table.

SQL Commands Categories:


It is divided into four cateogries. They are:

SQL

DDL CREATE, ALTER, and DROP

DML INSERT, UPDATE, DELETE, SELECT

DCL GRANT, REVOKE

TCL Roll Back, Commit, Save Point

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.

Example:pip install mysql-connector-python

 After Successful installation we must import python sql connector by using import
keyword.
 Example: import mysql.connector

Steps for creating database connectivity applications:


Step 1: Start Python: Start python editor to create your python script

Step 2: mysql.connector package

Step 3: Establishing connection to MySQL DATABASE

We need to establish a connection to a mysql database using connect() function of


mysql.connector package.

The connect statement creates a connection to the mysql server and returns a MySQL
connection object.

Syntax:

Connection object>=mysql.connectorconnect (host=<hostname>, user=<username>,


password=<password>, database=<dbname>)

Example:
import mysql.connector
con=mysql.connector.connect(host="localhost", user="root", password="root")

8
Creating a cursor Object:

It is a useful control structure of database connectivity. It will let us execute all


the queries we need. Cursor stores all the data as a temporary container of returned data
and allows traversal so that we can fetch data one row at a time from cursor. Cursors are
created by the connection.cursor() method.

Syntax:cursor object =<connectionobject> .cursor()

Example: Cursor=con.cursor()

Execute SQL query:


We can execute SQL query using execute() function

Syntax: cursor object.execute(SQL QUERY)

Example: cursor.execute("select* from data")

The above code will execute the sql query and store the retrieved records (resultset) in
the cursor object(cursor).

Extract data from Result set:

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.

(i) fetchall() (ii) fetchone() (iii) fetchmany()

Ways to retrieve data

fetchall()-Fetches all (remaining) rows of a query result. returning them as a sequence of


sequences (e.g. a list of tuples).

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

manage the hotel activities.

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

requested number of days.

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

of the hotel's information and booking system.

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:

 PROCESSOR : INTEL PENTIUM (ANY) OR AMD

ATHALON (3800+- 4200+ DUAL CORE)

 MOTHERBOARD : 1.845 OR 915,995 FOR PENTIUM or

MSI K9MM-V VIA K8M800+8237R PLUS

CHIPSET FOR AMD ATHALON

 RAM : 512MB+

 Hard disk : SATA 40 GB OR ABOVE

 CD/DVD r/w : (If back up required)

 MONITOR : 14.1 or 15 -17 inch

 Key board and mouse : Any Company keyboard and Optical Mouse

 Printer : (if print is required – [Hard copy])

SOFTWARE REQUIREMENTS:

 Windows 7(SP1) or higher / Any OS (I.e. Linux, Unix, Ubuntu, MacOS)

 Python IDLE 3.6 or higher or spyder (as front end).

 Microsoft Word 2007 or higher for documentation.

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

 To store inputs, in this project I have used Mysql.

 Interfacing python with mysql we can store and retrieve data back easily.

 The following are the details of Database and Tables:

Database Name:HOTEL

Details of the tables used in this project:

In this project I have used the following tables:

(i) Table Name : Room

 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

(iii) Table Name : USER

 This table is used to store the details of Users/Visitors . It is used to store


USERID, USERNAME, AGE, GENDER AADHAR MOBILE Number, EMAILand
ORIGIN.
Field Name Data Type Remarks
UID Int Primary Key
USERNAME Varhcar(20)
AGE INT
GENDER Varchar(7)
AADHAR INT
MOBILE Varhcar(20)
EMAIL VARCHAR(35)
ORIGIN VARCHAR(15)

(iv) Table Name : Book

 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

MODULES OF HOTEL MANAGEMENT SYSTEM:

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:

5. USER MENU and BOOKING:

33
6. USER DISPLAY MENU:

7. USER SEARCH MENU:

8. BOOKING MENU:

***************************************************************************

34
BIBLIOGRAPHY

BOOKS:

 COMPUTER SCIENCE WITH PYTHON - BY SUMITA ARORA


 COMPUTER SCIENCE WITH PYTHON - BY PREETI ARORA
 PYTHON DATA VISUALIZATION - BY KALLUR RAHMAN

WEBSITES:

 www.geeksforgeeks.org
 https://docs.python.org/3/

35

You might also like