Professional Documents
Culture Documents
COMPUTER PROJECT - Ritabrata
COMPUTER PROJECT - Ritabrata
PROJECT REPORT ON
HOTEL
MANAGEMENT
SYSTEM IN PYTHON
CLASS : XII
STREAM : SCIENCE
SUBJECT : COMPUTER SCIENCE
SUBJECT CODE : 083
PROJECT GUIDE : Ms. SAYANI HAZRA PAL
PGT (CS)
CERTIFICATE
______________________ _____________________
Mrs. MADHUMITA SINGH Ms. SAYANI HAZRA PAL
(Principal) (Internal Examiner)
_______________________
External Examiner
Acknowledgement
It is really amazing to try figuring out that the lion share of this
world’s businesses are handled by computers, or more specifically,
computing devices alone. The technology has been soaring so high
lately that human involvement in many of these trades are considered
to be solely intrusive. And yes, so says the facts. Practically, humans
are left with the part of making algorithms (or programs) that run on
several software pre-installed on the device, and often some manual
works of data entry.
RITABRATA DAS
CLASS – XII (SCIENCE)
CONTENTS
Sl. Page
DESCRIPTION
No. No.
1. INTRODUCTION 1
3. SYSTEM REQUIRMENT 2
6. SOURCE CODE 7 - 20
7. OUTPUT 21 - 27
8. SCOPE 28
9. LIMITATIONS 28
10. CONCLUSION 29
11. BIBLIOGRAPHY 30
INTRODUCTION
hotel that has two branches, namely Royal Stay in Mumbai and Taj
Palace in Chennai. The code offers to enter the customer name and
their details like address, Mobile Number etc., which are further
1
OBJECTIVES OF THE PROJECT
R E Q U I R E M E N T S
Hardware Required
Software Required
2
3
4
5
FUNCTIONS & TEXT FILES USED
A. Developed Functions
1. Add() – Takes all details of a new customer as input and stores it
with associated customer ID in the parent database.
2. Search() – Asks for a customer key. If the key is valid, it shows all
details of that customer, otherwise returns error.
3. Display() – Displays all available records present in the parent
database currently.
4. Edit() – Initially, it displays all the records, similar to the Display()
function. It, then, asks for the customer ID whose details are to be
edited. New values are taken as input and corresponding changes
are made. The final records are shown.
5. Delete() – Shows all records before deletion. Asks for the
customer ID of the record to be deleted. Deletes the record and
prints the deleted record again.
6. Generate() – Calculates the net payable amount of each customer
and includes corresponding taxes.
B. Built-in functions & Methods
1. str.center(<no_of_char>,<spacing_unit>) – Used to shift the
string to the right by declared no. of spacing units.
2. <cursor_object>.is_connected – Checks connection of Python
with database.
3. <file_handle>.read(n) – Reads specified no. of bytes from the file
connected by specified file handle.
4. <query>.format() – Method of formatting in MySQL using Python
code.
5. <conn_object>.cursor – Sets up the cursor object for the database
in Python.
6. <cursor_object>.fetchall() – Retrieves all data stored in the cursor
object.
7. <conn_object>.commit() – Ensures that the query executed has
functioned effectively.
C. Text Files Used
1. RoyalStay.txt – The text file gives the description along with the
address of the Hotel Royal Stay in Mumbai. The file also discusses
the facilities and prospects of the hotel.
2. TajPalace.txt – This text file comes with similar features as
RoyalStay.txt but applies to Hotel Taj Palace in Chennai.
6
SOURCE CODE
#Project on Hotel Reservation System - Python-MySQL connectivity
import mysql.connector
print('\n')
print("======================================D.A.V. PUBLIC SCHOOL,KOLKATA
============================ ")
print('\n')
print("================================HOTEL RESERVATION SYSTEM
==============================")
print('\n')
hh= "This project has been created by following students of Class XII-Science"
kk="Abhishek Ray"
tt="Joyosmit Pal"
rr="Ritabrata Das"
print(' '*66,hh)
print(kk.center(239,' '))
print(tt.center(239,' '))
print(rr.center(239,' '))
print()
7
check_in = input("Enter the Check In Date (YYYY-MM-DD): ")
check_out = input("Enter Check Out Date (YYYY-MM-DD): ")
adv_payment = float(input("Enter the Advance Amt: "))
room_type = int(input("Room Type:-\n1:Suite (Rs.1500 /day) \n2:Delux (Rs. 1000 /
day) \n3: Standard (Rs. 500/day)"))
if room_type==1:
room_type="Suite"
elif room_type==2:
room_type="Delux"
elif room_type==3:
room_type="Standard"
else:
print("Enter the correct Choice")
def search():
mydb=mysql.connector.connect(host="localhost",user="root",passwd="ritabrata_2004D
AS", database="dbproject")
mycur = mydb.cursor()
cno = int(input("Enter the Customer id: "))
st= "Select * from hotel where cust_id={}"
query=st.format(cno)
print("==========================================")
mycur.execute(query)
myrec=mycur.fetchall()
for x in myrec:
cust_id = x[0]
cust_name = x[1]
address = x[2]
room_no = x[3]
mobile_no = x[4]
check_in = x[5]
check_out = x[6]
adv_payment = x[7]
room_type = x[8]
8
print('cust_id', 'cust_name', 'address', '\troom_no', 'mobile_no', 'check_in',
'\tcheck_out', '\tadv_payment', 'room_type',sep='\t')
print(cust_id, cust_name, address, room_no, mobile_no, check_in, check_out,
adv_payment,' '*3,room_type,sep='\t')
def display():
mydb=mysql.connector.connect(host="localhost",user="root",passwd="ritabrata_2004D
AS",database="dbproject")
mycur=mydb.cursor()
mycur.execute("Select * from hotel")
print("==========================================")
myrec=mycur.fetchall()
for x in myrec:
cust_id = x[0]
cust_name = x[1]
address = x[2]
room_no = x[3]
mobile_no = x[4]
check_in = x[5]
check_out = x[6]
adv_payment = x[7]
room_type = x[8]
def edit():
mydb=mysql.connector.connect(host="localhost",user="root",passwd="ritabrata_2004D
AS", database="dbproject")
mycur=mydb.cursor()
mycur.execute("Select * from hotel")
print("==========================================")
print("Before Updation")
myrec=mycur.fetchall()
for x in myrec:
cust_id=x[0]
cust_name=x[1]
address=x[2]
room_no=x[3]
mobile_no=x[4]
check_in=x[5]
check_out=x[6]
adv_payment=x[7]
room_type=x[8]
9
print('cust_id', 'cust_name', 'address', '\troom_no', 'mobile_no', 'check_in',
'\tcheck_out', '\tadv_payment', 'room_type',sep='\t')
print(cust_id, cust_name, address, room_no, mobile_no, check_in, check_out,
adv_payment,' '*3,room_type,sep='\t')
cust_id=int(input("Enter Customer id whose record is to be Updated: "))
print("Enter the new data\n")
cust_name = input("Enter Customer name: ")
address = input("Enter Address: ")
room_no = int(input("Enter Room No: "))
mobile_no = int(input("Enter Mobile No: "))
check_in = input("Check In Date (YYYY-MM-DD): ")
check_out = input("Check Out Date (YYYY-MM-DD): ")
adv_payment = float(input("Enter the Advance Amt paid: "))
room_type = int(input("Room Type:-(1:Suite 2: Deluxe 3:Common)"))
if room_type==1:
room_type = "Suite"
elif room_type==2:
room_type = "Deluxe"
elif room_type==3:
room_type = "Standard"
else:
print("Enter your Choice")
mycur=mydb.cursor()
st="""Update hotel set cust_name='{}',address='{}',room_no={},
mobile_no={},check_in='{}',check_out='{}',adv_payment={},room_type='{}'where
cust_id={}"""
query =
st.format(cust_name,address,room_no,mobile_no,check_in,check_out,adv_payment,roo
m_type,cust_id)
mycur.execute(query)
mydb.commit()
mycur.execute("Select * from hotel")
print("==========================================")
print("After Update")
myrec = mycur.fetchall()
for x in myrec:
cust_id=x[0]
cust_name=x[1]
address=x[2]
room_no=x[3]
mobile_no=x[4]
check_in=x[5]
check_out=x[6]
adv_payment=x[7]
room_type=x[8]
10
print('cust_id', 'cust_name', 'address', '\troom_no', 'mobile_no', 'check_in',
'\tcheck_out', '\tadv_payment', 'room_type',sep='\t')
print(cust_id, cust_name, address, room_no, mobile_no, check_in, check_out,
adv_payment,' '*3,room_type,sep='\t')
def delete():
mydb=mysql.connector.connect(host="localhost",user="root",
passwd="ritabrata_2004DAS",database="dbproject")
mycur=mydb.cursor()
for x in myrec:
cust_id = x[0]
cust_name = x[1]
address = x[2]
room_no = x[3]
mobile_no = x[4]
check_in = x[5]
check_out = x[6]
adv_payment = x[7]
room_type = x[8]
print("Record Deleted")
mycur.execute("Select * from hotel")
print("==========================================")
print("After Deletion")
myrec=mycur.fetchall()
for x in myrec:
cust_id = x[0]
cust_name = x[1]
address = x[2]
room_no = x[3]
11
mobile_no = x[4]
check_in = x[5]
check_in = x[6]
adv_payment = x[7]
room_type = x[8]
print('cust_id', 'cust_name', 'address', '\troom_no', 'mobile_no', 'check_in',
'\tcheck_out', '\tadv_payment', 'room_type',sep='\t')
print(cust_id, cust_name, address, room_no, mobile_no, check_in, check_out,
adv_payment,' '*3,room_type,sep='\t')
def generate():
Tax=0
mydb=mysql.connector.connect(host="localhost",user="root",
passwd="ritabrata_2004DAS",database="dbproject")
mycur=mydb.cursor()
for x in myrec:
cust_id = x[0]
cust_name = x[1]
address = x[2]
room_no = x[3]
mobile_no = x[4]
check_in = x[5]
check_out = x[6]
adv_payment = x[7]
room_type = x[8]
days = x[9]
print('=================================================')
print(" HOTEL ROYAL STAY")
print()
print(" 34, MIDC Central Road, Mumbai ")
print('=================================================')
print("Customer No. ...",cust_id)
print("Customer Name ...",cust_name)
print("Customer Address ...",address)
print('=================================================')
print("Room No ...", room_no)
print("Mobile No ...", mobile_no)
print('=================================================')
12
print("Check In Date...", check_in)
print("Check Out Date...", check_out)
print("Room Type ...", room_type)
print('=================================================')
print("No. of Days...", days)
if room_type == "Suite":
price = 1500
elif room_type=="Deluxe":
price = 1000
else:
price = 500
Total = days*price
print("Total", Total)
print("Advance", adv_payment)
Tax = Total*0.18
print("Tax: ",Tax)
net = (float(Total)+float(Tax))-float(adv_payment)
netamt = float(Total)+float(Tax)
print("Net Amount",netamt)
print("Total Amount Payable ",net)
ch = 'y'
while ch=='y' or ch=='Y':
print("======================================")
print("MENU")
print("1. To Add a New Record")
print("2.To Search a Record")
print("3.To Update a Record")
print("4.To Delete a Record")
print("5.To View all the Records")
print("6.To Generate the Bill\n")
print("======================================")
13
ch=input("Want to display Main Menu? (y/n)...")
print("==========================================")
print('\n')
print('Thank you for visiting our hotel! If you have liked our service, please go to our
website www.splendidparadormumbai.com and give your ratings!')
elif hotelchoice=="Chennai":
print()
with open(r'C:\Users\Ritabrata\Desktop\TajPalace.txt' ,'r') as file1:
fhc= file1.read()
print(fhc)
print()
def Add():
ch='y'
while ch=='y' or ch=='Y':
cust_id = int(input("\nEnter The Customer id: "))
cust_name = input("Enter the Customer name: ")
address = input("Enter The Address: ")
room_no = int(input("Enter The Room No: "))
mobile_no = int(input("Enter The Mobile No: "))
check_in = input("Enter the Check In Date (YYYY-MM-DD): ")
check_out = input("Enter Check Out Date (YYYY-MM-DD): ")
adv_payment = float(input("Enter the Advance Amt: "))
room_type = int(input("Room Type:-\n1:Suite (Rs.1500 /day) \n2:Delux (Rs. 1000 /
day) \n3: Standard (Rs. 500/day)"))
if room_type==1:
room_type="Suite"
elif room_type==2:
room_type="Delux"
elif room_type==3:
room_type="Standard"
else:
print("Enter the correct Choice")
def Search():
mydb=mysql.connector.connect(host="localhost",user="root",passwd="ritabrata_2004D
AS", database="dbproject")
mycur = mydb.cursor()
cno = int(input("Enter the Customer id: "))
st= "Select * from d_hotel where cust_id={}"
14
query=st.format(cno)
print("==========================================")
mycur.execute(query)
myrec=mycur.fetchall()
for x in myrec:
cust_id = x[0]
cust_name = x[1]
address = x[2]
room_no = x[3]
mobile_no = x[4]
check_in = x[5]
check_out = x[6]
adv_payment = x[7]
room_type = x[8]
def Display():
mydb=mysql.connector.connect(host="localhost",user="root",passwd="ritabrata_2004D
AS",database="dbproject")
mycur=mydb.cursor()
mycur.execute("Select * from d_hotel")
print("==========================================")
myrec=mycur.fetchall()
for x in myrec:
cust_id = x[0]
cust_name = x[1]
address = x[2]
room_no = x[3]
mobile_no = x[4]
check_in = x[5]
check_out = x[6]
adv_payment = x[7]
room_type = x[8]
15
def Edit():
mydb=mysql.connector.connect(host="localhost",user="root",passwd="ritabrata_2004D
AS", database="dbproject")
mycur=mydb.cursor()
mycur.execute("Select * from d_hotel")
print("==========================================")
print("Before Updation")
myrec=mycur.fetchall()
for x in myrec:
cust_id=x[0]
cust_name=x[1]
address=x[2]
room_no=x[3]
mobile_no=x[4]
check_in=x[5]
check_out=x[6]
adv_payment=x[7]
room_type=x[8]
if room_type==1:
room_type = "Suite"
elif room_type==2:
room_type = "Deluxe"
elif room_type==3:
room_type = "Standard"
else:
print("Enter your Choice")
16
mycur=mydb.cursor()
st="""Update d_hotel set cust_name='{}',address='{}',room_no={},
mobile_no={},check_in='{}',check_out='{}',adv_payment={},room_type='{}'where
cust_id={}"""
query =
st.format(cust_name,address,room_no,mobile_no,check_in,check_out,adv_payment,roo
m_type,cust_id)
mycur.execute(query)
mydb.commit()
mycur.execute("Select * from d_hotel")
print("==========================================")
print("After Update")
myrec = mycur.fetchall()
for x in myrec:
cust_id=x[0]
cust_name=x[1]
address=x[2]
room_no=x[3]
mobile_no=x[4]
check_in=x[5]
check_out=x[6]
adv_payment=x[7]
room_type=x[8]
def Delete():
mydb=mysql.connector.connect(host="localhost",user="root",
passwd="ritabrata_2004DAS",database="dbproject")
mycur=mydb.cursor()
for x in myrec:
cust_id = x[0]
cust_name = x[1]
address = x[2]
room_no = x[3]
mobile_no = x[4]
check_in = x[5]
17
check_out = x[6]
adv_payment = x[7]
room_type = x[8]
print("Record Deleted")
mycur.execute("Select * from d_hotel")
print("==========================================")
print("After Deletion")
myrec=mycur.fetchall()
for x in myrec:
cust_id = x[0]
cust_name = x[1]
address = x[2]
room_no = x[3]
mobile_no = x[4]
check_in = x[5]
check_in = x[6]
adv_payment = x[7]
room_type = x[8]
def Generate():
Tax=0
mydb=mysql.connector.connect(host="localhost",user="root",
passwd="ritabrata_2004DAS",database="dbproject")
mycur=mydb.cursor()
18
query=st.format(cust_id)
mycur.execute(query)
myrec=mycur.fetchall()
for x in myrec:
cust_id = x[0]
cust_name = x[1]
address = x[2]
room_no = x[3]
mobile_no = x[4]
check_in = x[5]
check_out = x[6]
adv_payment = x[7]
room_type = x[8]
days = x[9]
print('=================================================')
print(" HOTEL TAJ PALACE")
print()
print(" 47/A, Mount Road, Chennai ")
print('=================================================')
print("Customer No. ...",cust_id)
print("Customer Name ...",cust_name)
print("Customer Address ...",address)
print('=================================================')
print("Room No ...", room_no)
print("Mobile No ...", mobile_no)
print('=================================================')
print("Check In Date...", check_in)
print("Check Out Date...", check_out)
print("Room Type ...", room_type)
print('=================================================')
print("No. of Days...", days)
if room_type == "Suite":
price = 1500
elif room_type=="Deluxe":
price = 1000
else:
price = 500
Total = days*price
print("Total", Total)
print("Advance", adv_payment)
Tax = Total*0.18
print("Tax: ",Tax)
net = (float(Total)+float(Tax))-float(adv_payment)
netamt = float(Total)+float(Tax)
19
print("Net Amount",netamt)
print("Total Amount Payable ",net)
ch = 'y'
while ch=='y' or ch=='Y':
print("======================================")
print("MENU")
print("1. To Add a New Record")
print("2.To Search a Record")
print("3.To Update a Record")
print("4.To Delete a Record")
print("5.To View all the Records")
print("6.To Generate the Bill\n")
print("======================================")
print("==========================================")
ch=input("Want to display Main Menu? (y/n)...")
print('\n')
print('Thank you for visiting our hotel! If you have liked our service, please go to our
website www.splendidparadorkolkata.com and give your ratings!')
20
OUTPUT
21
SCREEN 3: INSERTING ANOTHER RECORD
22
SCREEN 5: UPDATING A RECORD
23
SCREEN 7: VIEWING ALL THE RECORDS
24
SCREEN 9: GENERATING THE REPORT (II)
SCREEN 10: TABLE HOTEL IN DATABASE DBPROJECT (LOCATION: MUMBAI) AS VIEWED IN SQL
25
SCREEN 11: THE D_HOTEL TABLE IN DBPROJECT (LOCATION: CHENNAI) AS VIEWED IN SQL
26
SCREEN 13: FILE SHOWING DESCRIPTION OF THE HOTEL AT MUMBAI
27
SCOPE
• This is a very efficient way of handling the Hotel records.
• Helps to record the information and seek security.
• Easy to register any new name of staff easily.
• Simple way of managing all records and manipulating
them.
• Less time consuming.
LIMITATIONS
28
CONCLUSION
29
BIBLIOGRAPHY
30