0% found this document useful (0 votes)
8 views

Computer Project

Computer Project Class 12 CBSE
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views

Computer Project

Computer Project Class 12 CBSE
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 13

PROJECT REQUIREMENTS

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

CREATEROOM() block: This block is used to create rooms in the


hotel. This is the input block.
SL.No. Object/Labels Description Use
used
1. rno int To store the room
number.
2. rtype string To store the Type of the
room.
3. guestno int To store the number of
guests that can
accommodate.
4. loc str To store the location of
the room.
5. rent int To store the per night
price of the room.
6. status str To store the status of the
room.
7. data tuple Temporary variable to
input the records into the
database.

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:

print("ENTER 1 TO- Create a NEW ROOM")

print("ENTER 2 TO- Show All Rooms")

print("ENTER 3 TO- Show All Vacant Rooms")

print("ENTER 4 TO- Show All Occupied Rooms")

print("ENTER 5 TO- Book a Room for a Customer")

print("ENETR 6 TO- Check Out a Customer")

print("ENTER 7 TO- Exit")

ch=int(input("Enter your choice : "))

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(" --------------------ENTER ROOM


DETAILS------------------------- ")
print("=============================================
=====================")

rno=int(input("Enter Room Number : "))

print("Enter room type: ")

print("(Simple/Double/Twin/Cabana/Studio/Lanai/
Standard suite/Executive suite)")

rtype=input("Enter your choice")

guestno=int(input("Enter maximum number of guests


that can be accomodated: "))

loc=input("Enter Location of the room : ")

rent=int(input("Enter Per Night Charges : "))

status= "Vacant"

q=”insert into rooms values(%s,%s,%s,%s,%s,%s)”

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():

q=”select * from rooms”

cur1=con.cursor()

cur1.execute(q)

res=cur1.fetchall()

for row in res:

print(row)

def SHOWVACANTROOMS():

q="select * from rooms where status='Vacant'"

cur1=con.cursor()

cur1.execute(q)

res=cur1.fetchall()

for row in res:

print(row)

7|Page
def SHOWOCCUPIEDROOMS():

q="select booking.room_no,cname,phone from


rooms,booking where status='Occupied' and
rooms.rno=booking.room_no"

cur1=con.cursor()

cur1.execute(q)

res=cr1.fetchall()

for row in res:

print(row)

def BOOKROOM():

print("=============================================
====================")

print("------------------BOOKING A ROOM FOR A


Customer--------------------")

print("=============================================
====================")

cname=input("Enter the Customer Name : ")

idtype=input("Enter the authorized ID submitted(PAN


Card/License/Aadhar Card/Passport) : ")

idno=input("Enter the ID number : ")

address=input("Enter Address of customer: ")

phone=input("Enter Phone number of customer: ")

gender=input("Enter Gender of customer: ")

dcheckin=input("Enter Date of Check in (yyyy-mm-


dd) : ")

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

q="update rooms set status='Occupied' where


room_no={}".format(room_no)

cur.execute(q)

con.commit()

print("=============================================
====================")

print("--------------------ROOM BOOKING IS
CONFIRMED--------------------")

print("=============================================
====================")

def CHECKOUT():

room_no=input("Enter the Room Number : ")

q="delete from booking where


room_no={}".format(room_no)

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

You might also like