Sample Project File 2
Sample Project File 2
BABRALA
INFORMATICS PRACTICES
PROJECT REPORT
ON
HOTEL MANAGEMENT SYSTEM
[submitted as a part of AISSCE 2019-20]
This is to certify that Project titled ‘Hotel Booking System’ has been
carried out during the academic session 2019-20 by Sandhi Yadav,
Akansha Yadav and Nandini Varshney of class XII Commerce under
my guidance and supervision. The project report is designed as per
the guidelines of Central Board of Secondary Education, and is being
submitted as a part of AISSCE Practical Examination 2019-20
conducted by CBSE.
___________________ ___________________
Signature Internal Examiner Signature External Examiner
Surendra Singh
DAV Fertilizer Public School
Babrala
ACKNOWLEDGEMENT
Sandhi Yadav
Akansha Yadav
Nandini Varshney
Scope and Objectives of the Project
Hardware Used:
Operating System : Windows 10 Pro
Processor : Intel® Core™ i7-6700 CPU @ 3.40 GHz
Memory (RAM) : 8.00 GB
System Type : 64-bit Operating System
Software Used:
Front End : Python 3.7.0
Back End : MySQL 5.4.1
Documentation : MS Word 2016
Database Structure
Auto_Increment,
RNo Int - Room No.
Primary Key
Address of
Address Varchar 50
Customer
#--------------------------------------------------------------------------------------------
# Create Data Table Function
#--------------------------------------------------------------------------------------------
def CreateTable():
try:
mycursor.execute("CREATE TABLE Hotel\
(RNo INT AUTO_INCREMENT PRIMARY KEY,\
cname VARCHAR(20),\
contact VARCHAR(10),\
address VARCHAR(50),\
checkin VARCHAR(10),\
checkout VARCHAR(10),\
adults INT(2),\
children INT(2));")
print("Table created successfully")
except:
print("Table Already Created.")
r=input("Press any key to continue.....")
Source Code:
#--------------------------------------------------------------------------------------------
# Room Booking Function
#--------------------------------------------------------------------------------------------
def Booking():
print()
print("----------------Data Entry----------------")
choice='y'
while(choice=='y' or choice=='Y'):
cn=input("Enter customer's name? ")
pno=int(input("Enter conotact number? "))
add=input("Enter customer's address? ")
ind=input("Enter check in date? ")
outd=input("Enter check out date? ")
ad=int(input("Enter number of adults? "))
chld=int(input("Enter number of children? "))
mycursor = mydb.cursor()
sql = "INSERT INTO Hotel(cname, contact, address, checkin,
checkout, adults, children)\
VALUES (%s, %s, %s, %s, %s, %s, %s)"
val = (cn,pno,add,ind,outd,ad,chld)
mycursor.execute(sql, val)
"""mydb.commit()required to make the changes,
otherwise no changes are made to the table."""
mydb.commit()
print(mycursor.rowcount, "Room booked successfully.")
print()
choice=input("Enter Y or y for more booking? ")
Source Code:
#--------------------------------------------------------------------------------------------
# Show All Booking Function
#--------------------------------------------------------------------------------------------
def ShowAll():
sql="select * from Hotel"
mycursor.execute(sql)
print()
print()
print("All Bookings")
print()
for row in mycursor:
print(row)
print()
print(mycursor.rowcount, "recods found.")
print()
r=input("Press any key to continue.....")
#--------------------------------------------------------------------------------------------
# Room Wise Search Booking Function
#--------------------------------------------------------------------------------------------
def SearchBooking():
rn=int(input("Enter Room Number? "))
sql = "SELECT * FROM Hotel WHERE RNo=%s"
mycursor.execute(sql, (rn,))
myresult = mycursor.fetchall()
if myresult != "":
for x in myresult:
print(x)
else:
print("Failed to get record from MySQL table")
r=input("Press any key to continue.....")
Source Code:
#--------------------------------------------------------------------------------------------
# Update Booking Function
#--------------------------------------------------------------------------------------------
def UpdateBooking():
rn=int(input("Room number to update the entry? "))
ind=input("Enter check in date? ")
outd=input("Enter check out date? ")
ad=int(input("Enter number of adults? "))
chld=int(input("Enter number of children? "))
str="UPDATE Hotel SET checkin=%s,checkout=%s, adults=%s,
children=%s where RNo=%s"
val=(ind,outd,ad,chld,rn)
mycursor.execute(str, val)
mydb.commit()
print()
print(mycursor.rowcount, "record updated successfully.")
print()
r=input("Press any key to continue.....")
Source Code:
#--------------------------------------------------------------------------------------------
# Cancel Booking Function
#--------------------------------------------------------------------------------------------
def CancelBooking():
import mysql.connector
from mysql.connector import Error
mydb=mysql.connector.connect(host="localhost",\
user="root",\
passwd="tcdav",\
database="school")
rn=int(input("Enter Room number to cancel booking? "))
mycursor = mydb.cursor()
sql = "DELETE FROM Hotel WHERE RNo = {}".format(rn)
mycursor.execute(sql)
mydb.commit()
print(mycursor.rowcount, "record(s) deleted")
print()
r=input("Press any key to continue.....")
Source Code:
#--------------------------------------------------------------------------------------------
# Menu
#--------------------------------------------------------------------------------------------
while True:
print("----------------------------------------------------------------------")
print("*********** Welcome to Hotel Booking ************")
print("----------------------------------------------------------------------")
print(" 1: Create Data Table")
print(" 2: Book your Room")
print(" 3: Show all Bookings ")
print(" 4: Search Booking(Room wise")
print(" 5: Update Booking")
print(" 6: Cancel Booking")
print(" 7: Exit")
print("---------------------------------------------------------------------")
print()
choice = int(input(" Please enter your choice: "))
if choice == 1 :
CreateTable()
elif choice == 2:
Booking()
elif choice == 3:
ShowAll()
elif choice == 4:
SearchBooking()
elif choice == 5:
UpdateBooking()
elif choice == 6:
CancelBooking()
elif choice == 7:
sys.exit()
else:
print("Error! Invalid choice, try again!")
conti=input("Press any key to continue..")
Menu Output:
Exit Output: