Hostel Management 3
Hostel Management 3
SCHOOL
BAHADURGARH
PRACTICAL FILE
ON
COMPUTER SCIENCE
(CODE-083)
SESSION: 2024-2025
SUBMITTED BY SUBMITTED TO
NAME : Harsh TEACHER’S NAME
ROLL NO.
Ms. Renu Ma’am
CLASS : XII-SCIENCE
(Ms Renu)
Computer Teacher
Principal signature
ACKNOWLEDGEMENT
I would like to express my special
thanks of gratitude to my computer
teacher MS Renu for their able
guidance and support in completing my
project.
SOURCE CODE
import mysql.connector
myConnnection =""
cursor=""
userName=""
password =""
roomrent =0
restaurentbill=0
gamingbill=0
fashionbill=0
totalAmount=0
cid=""
global myConnection
global userName
global password
if myConnection:
cursor=myConnection.cursor()
cursor.execute("COMMIT")
cursor.close()
return myConnection
else: print("\nERROR ESTABLISHING MYSQL CONNECTION CHECK USERNAME AND PASSWORD !")
def MYSQLconnection ()
global username
global password
global myConnection
global cid
myConnection=mysql.connector.connect(host="localhost",user=userName,passwd=password ,
database="HMS" , auth_plugin='mysql_native_password' )
if myConnection:
return myConnection
else:
myConnection.close()
def userEntry():
global cid
if myConnection:
cursor.execute(createTable)
cursor.close()
else:
def bookingRecord():
global cid
customer=searchCustomer()
if customer:
if myConnection:
cursor=myConnection.cursor()
cursor.execute(createTable)
cursor.execute("COMMIT")
cursor.close()
else:
def roomRent():
global cid
customer=searchCustomer()
if customer:
global roomrent
if myConnection:
cursor=myConnection.cursor()
cursor.execute(createTable)
print ("\n ##### We have The Following Rooms For You #####")
if roomchoice==1:
elif roomchoice==2:
elif roomchoice==3:
elif roomchoice==4:
else:
print("Sorry ,May Be You Are Giving Me Wrong Input, Please Try Again !!! ")
cursor.execute(sql,values)
cursor.execute("COMMIT")
print("Thank You , Your Room Has Been Booked For : ",noofdays , "Days" )
cursor.close()
else:
def Restaurent():
global cid
customer=searchCustomer()
if customer:
global restaurentbill
if myConnection:
cursor.execute(createTable)
if choice_dish==1:
elif choice_dish==2:
elif choice_dish==3:
else:
print("Sorry ,May Be You Are Giving Me Wrong Input, Please Try Again !!! ")
values= (cid,choice_dish,quantity,restaurentbill)
cursor.execute(sql,values)
cursor.execute("COMMIT")
cursor.close()
def Gaming():
global cid
customer=searchCustomer()
if customer:
global gamingbill
if myConnection:
cursor.execute(createTable)
7. Exit """)
print("\n\n#################################################")
if game==1:
elif game==3:
elif game==4:
elif game==5:
else:
print("Sorry ,May Be You Are Giving Me Wrong Input, Please Try Again !!! ")
values= (cid,game,hour,gamingbill)
cursor.execute(sql,values)
cursor.execute("COMMIT")
print("FOR : ",hour," HOURS","\n *** WE HOPE YOU WILL ENJOY YOUR GAME ***")
print("\n\n#################################################")
cursor.close()
else:
def Fashion():
global cid
customer=searchCustomer()
if customer:
global fashionbill
if myConnection:
cursor=myConnection.cursor()
createTable ="""CREATE TABLE IF NOT EXISTS FASHION(CID VARCHAR(20),DRESS
VARCHAR(30),AMOUNT VARCHAR(30),BILL VARCHAR(30))”””
if dress==1:
print("\nShirts")
elif dress==2:
print("\nT-Shirts")
elif dress==3:
print("\nPants")
elif dress==4:
print("\nJeans")
elif dress==5:
print("\nTassel top")
elif dress==7:
print("\nWestern dress")
elif dress==8:
print("\nSkirts")
elif dress==9:
print("\nTrousers")
elif dress==10:
print("\nInnerWear")
fashionbill = quantity * 30
else:
print("Sorry ,May Be You Are Giving Me Wrong Input, Please Try Again !!! ")
values= (cid,dress,quantity,fashionbill)
cursor.execute(sql,values)
cursor.execute("COMMIT")
print("\n\n#################################################")
cursor.close()
else:
def totalAmount():
global cid
customer=searchCustomer()
if customer:
global grandTotal
global roomrent
global restaurentbill
global fashionbill
global gamingbil
if myConnection:
cursor=myConnection.cursor()
cursor.execute(createTable)
cursor.close()
cursor.close()
else:
print("\nERROR ESTABLISHING MYSQL CONNECTION !")
def searchOldBill()
if customer:
if myConnection:
cursor=myConnection.cursor()
cursor.execute(sql,(cid,))
data=cursor.fetchall()
if data:
print(data)
else:
cursor.close()
else:
def searchCustomer():
global cid
if myConnection:
cursor=myConnection.cursor()
data=cursor.fetchall()
if data:
print(data)
return True
else:
return False
cursor.close()
else:
myConnection = MYSQLconnectionCheck ()
if myConnection:
MYSQLconnection ()
while(True):
2--->Booking Record
10--->EXIT """)
if choice == 1:
userEntry()
bookingRecord()
roomRent()
Restaurent()
Gaming()
searchCustomer()
totalAmount()
searchOldBill()
break else:
print("Sorry ,May Be You Are Giving Me Wrong Input, Please Try Again !!! ")
else:
# END OF PROJECT
4 RAM : 4GB
SOFTWARE REQUIREMENT
1 WINDOWS 7
3 MYSQL
BIBLIOGRAPHY
TO COMPLETE THIS PROJECT I TOOK HELP FROM
WEBSITE: www.w3school.com
WEBSITE: www.python.org
WEBSITE: www.tutorailpoint.com