Computer Project
Computer Project
SOFTWARE:-
PYTHON 3.7
MYSQL9
HARDWARE:-
PC WITH WINDOWS INSTALLED
------------------------------------------------------------------------------------------------------------------------------------------
PROJECT DESCRIPTION
This is a hotel management system. Using this system, we can get the details of the
available rooms and types of rooms available. Also we can book the room using
this. Images of rooms can also be viewed using this. We can also cancel our
booked rooms using this. The frontend software used in this project is Python 3.7
and the backend software used is MySQL 8.
DATA DICTIONARY
1|Page
SHOWMENU() Block: This block is used to show the various options
to the users.
SL.NO. Object/ Description Use
Labels Used
1. Ch int Temporary variable to store
the choices of the user.
SHOWROOMS() Block: This block shows the status all all rooms in
the hotel.
2|Page
SHOWVACANTROOMS() Block: This block is used to show the
details and status of all the available rooms in the hotel.
SHOWOCCUPIEDROOMS() Block: This block is used to show the
status of all occupied rooms in the hotel.
BOOKROOM() Block: This block is used to book rooms for the user.
This is basically the modification block.
Sl No. Objects/Labels Description Use
Used
1. Cname str To store the name of the
customer.
2. idtype str To store the identity type
of the customer.
3. idno str To store the ID number
of the customer.
4. address str To store the address of
the customer.
5. phone int To store the phone
number of the customer
6. gender str To store the gender of the
customer.
7. dcheckin str To store the date of check
in.
8. room_no int To store the room
number.
9. data tuple To input the records into
the database.
CHECKOUT() Block: This block deletes the status and records when a
customer checkout from the hotel. This is the deletion block.
3|Page
IN BUILT MODULE USED:
mysql.connector Module: This enables the python program to access
MySQL databases. The database used in the program is HOTEL.
CODE
import mysql.connector as mycon
4|Page
con=mycon.connect(host=”localhost”,user=”root”,password
=”123456”,database=”HOTEL”)
def SHOWMENU():
print("=============================================
====================")
print("--------------------WELCOME TO HOTEL
NIRVANA---------------------")
print("=============================================
====================")
while True:
if ch == 1:
CREATEROOM()
elif ch== 2:
SHOWROOMS()
elif ch== 3:
SHOWVACANTROOMS()
elif ch== 4:
5|Page
SHOWOCCUPIEDROOMS()
elif ch== 5:
BOOKROOM()
elif ch== 6:
CHECKOUT()
elif ch== 7:
break
def CREATEROOM():
print("=============================================
====================")
print("(Simple/Double/Twin/Cabana/Studio/Lanai/
Standard suite/Executive suite)")
status= "Vacant"
6|Page
data=(rno,rtype,guestno,loc,rent,status)
cur1=con.cursor()
cur1.execute(q,data)
con.commit()
print("=============================================
====================")
print("------------------ROOM CREATION IS
SUCCESSFULL-------------------")
print("=============================================
====================")
def SHOWROOMS():
cur1=con.cursor()
cur1.execute(q)
res=cur1.fetchall()
print(row)
def SHOWVACANTROOMS():
cur1=con.cursor()
cur1.execute(q)
res=cur1.fetchall()
print(row)
7|Page
def SHOWOCCUPIEDROOMS():
cur1=con.cursor()
cur1.execute(q)
res=cr1.fetchall()
print(row)
def BOOKROOM():
print("=============================================
====================")
print("=============================================
====================")
8|Page
room_no=int(input("Enter Room number : "))
q="insert into
booking(cname,idtype,idno,address,phone,gender,dateo
fcheckin,room_no) values(%s,%s,%s,%s,%s,%s,%s,%s)"
data=(cname,idtype,idno,address,phone,gender,dchecki
n,room_no)
cur1=con.cursor()
cur1.execute(q,data)
con.commit()
cur.execute(q)
con.commit()
print("=============================================
====================")
print("--------------------ROOM BOOKING IS
CONFIRMED--------------------")
print("=============================================
====================")
def CHECKOUT():
cur1=con.cursor()
cur1.execute(q)
9|Page
q="update rooms set status='Vacant' where
rno={}".format(room_no)
cur1.execute(q)
con.commit()
print("=============================================
====================")
print("--------------------CHECK OUT IS
CONFIRMED--------------------")
print("=============================================
====================")
if con.is_connected():
SHOWMENU()
con.close()
10 | P a g e
OUTPUT
11 | P a g e
12 | P a g e
BIBLIOGRAPHY
Python for class 12 by Sumita Arora
https://www.python.org
https://www.geeksforgeeks.org
13 | P a g e