Hotel Management
Hotel Management
Hotel Management
DBMS : MYSQL
HOST: LOCALHOST
USER:ROOT
PASSWORD :ROOT
DATABSE : HOTEL
im
port os
import platform
import mysql.connector
import pandas as pd
import datetime
global z
Page 1 of 12
host='localhost')
mycursor=mydb.cursor()
def create_db():
try:
mycursor = mydb.cursor()
except:
def create_table():
try:
mydb = mysql.connector.connect(host="localhost",user="root",passwd="root",database="hotel")
mycursor = mydb.cursor()
mycursor.execute(createRoomType)
mycursor.execute(q1)
mycursor.execute(createRestaurent)
(5,"sandwich",50),(6,"Dhokla",30),(7,"kachori",10),(8,"milk",20),\
Page 2 of 12
(9,"noodles",50),(10,"pasta",50)"""
print("Add dishes")
mycursor.execute(q2)
mycursor.execute(createLaundary)
print("Created laundary")
mycursor.execute(q3)
mydb.commit()
except:
def registercust():
mydb = mysql.connector.connect(host="localhost",user="root",passwd="root",database="hotel")
mycursor=mydb.cursor()
L=[]
name=input("enter name:")
L.append(name)
addr=input("enter address:")
L.append(addr)
L.append(indate)
L.append(outdate)
cust=(L)
print(cust)
mycursor.execute(sql,cust)
Page 3 of 12
mydb.commit()
def roomtypeview():
mydb = mysql.connector.connect(host="localhost",user="root",passwd="root",database="hotel")
mycursor=mydb.cursor()
print("Do yoy want to see room type available : Enter 1 for yes :")
if ch==1:
mycursor.execute(sql)
rows=mycursor.fetchall()
for x in rows:
print(x)
def roomrent():
mydb = mysql.connector.connect(host="localhost",user="root",passwd="root",database="hotel")
mycursor=mydb.cursor()
if(x==1):
s=1000*n
elif (x==2):
Page 4 of 12
s=2000*n
elif (x==3):
s=3000*n
elif (x==4):
s=4000*n
else:
def restaurentmenuview():
mydb = mysql.connector.connect(host="localhost",user="root",passwd="root",database="hotel")
mycursor=mydb.cursor()
print("Do yoy want to see mebu available : Enter 1 for yes :")
if ch==1:
mycursor.execute(sql)
rows=mycursor.fetchall()
for x in rows:
print(x)
def orderitem():
mydb = mysql.connector.connect(host="localhost",user="root",passwd="root",database="hotel")
mycursor=mydb.cursor()
global s
print("Do yoy want to see mebu available : Enter 1 for yes :")
if ch==1:
Page 5 of 12
sql="select * from restaurent"
mycursor.execute(sql)
rows=mycursor.fetchall()
for x in rows:
print(x)
if(d==1):
a=int(input("enter quantity"))
s=10*a
elif (d==2):
a=int(input("enter quantity"))
s=10*a
elif(d==3):
a=int(input("enter quantity"))
s=20*a
elif(d==4):
a=int(input("enter quantity"))
s=10*a
elif(d==5):
Page 6 of 12
print("you have ordered sandwich")
a=int(input("enter quantity"))
s=50*a
elif(d==6):
a=int(input("enter quantity"))
s=30*a
elif(d==7):
a=int(input("enter quantity"))
s=10*a
elif(d==8):
a=int(input("enter quantity"))
s=20*a
elif(d==9):
a=int(input("enter quantity"))
s=50*a
elif(d==10):
a=int(input("enter quantity"))
s=50*a
Page 7 of 12
print("your amount for pasta is :",s,"\n")
else:
def laundarybill():
mydb = mysql.connector.connect(host="localhost",user="root",passwd="root",database="hotel")
mycursor=mydb.cursor()
global z
print("Do yoy want to see rate for laundary : Enter 1 for yes :")
if ch==1:
mycursor.execute(sql)
rows=mycursor.fetchall()
for x in rows:
print(x)
z=y*10
return z
def lb():
print(z)
def res():
print(s)
def viewbill():
print("laundarey bill:")
print(lb)
Page 8 of 12
print("restaurent bill:")
print(res)
def Menuset():
try:
except ValueError:
if(userinput==1):
registercust()
elif(userinput==2):
roomtypeview()
elif(userinput==3):
roomrent()
elif(userinput==4):
restaurentmenuview()
elif(userinput==5):
orderitem()
elif(userinput==6):
laundarybill()
Page 9 of 12
elif(userinput==7):
viewbill()
elif(userinput==8):
quit()
else:
create_db()
create_table()
Menuset()
def runagain():
while(runagn.lower()=='y'):
if(platform.system()=="windows"):
print(os.system('cls'))
else:
print(os.system('clear'))
Menuset()
runagain()
Page 10 of 12
Page 11 of 12
Page 12 of 12