0% found this document useful (0 votes)
20 views23 pages

Project File On Hotel Mangment System

Uploaded by

nitin260408.k
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
20 views23 pages

Project File On Hotel Mangment System

Uploaded by

nitin260408.k
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 23

Computer Science

Project File
On
Hotel Management System

Prepared By:
Name:
Class:
Session: 2024 – 2025
Board Roll No.
Saraswati Vidya Mandir
GT Road
Etah
Acknowledgement
It would be my utmost pleasure to express my sincere thanks to my computer
science teacher Mr. Yogesh Kumar Mishra is providing a helping hand in this
project. His unflagging patience, creativity and immense knowledge that he
shared with me have proved highly beneficial to me and have made my project
file both possible and successful.

Name:

Class:
Certificate
This is to certify that this project file has been completed by
_ bearing roll number
of class 12th during the session 2024-2025.

We certify that this project work is completely original and having unique
identify.

We congratulate him for his hard work and determination in carrying out
this practical work and wish him all the success in future.

Mr. Yogesh Kumar Mishra Mr. Pramod Kumar Verma


(PGT Computer Science) (Principal)
CODING
import pickle
import time
import os

def set_data():
cname = input('Enter Customer Name: ')
cadd = input('Enter Customer Address: ')
mob = input('Enter Customer Mobile Number: ')
adhar = input('Enter Customer Adhar Card Number: ')
roomno = int(input('Enter Alloted Room No: '))
checkin = input("Enter Check In Date: ")
days = int(input("Enter the no of days: "))
print()
#create a dictionary
customer = {}
customer['cname'] = cname
customer['cadd'] = cadd
customer['mob'] = mob
customer['adhar'] = adhar
customer['roomno'] = roomno
customer['checkin'] = checkin
customer['days'] = days
customer['totalfare']=days*250
return customer

def display_data(customer):
print('\nCUSTOMER DETAILS..')
print('Name:', customer['cname'])
print('Address:', customer['cadd'])
print('Mobile:', customer['mob'])
print('Adhar:', customer['adhar'])
print('Room No:', customer['roomno'])
print('Check In Date:', customer['checkin'])

def display_data_tabular(customer):
print('\n...........BILL PRINTING...........\n')
print('Room No:\t\t', customer['roomno'])
print('Name:\t\t\t', customer['cname'])
print('Address:\t\t', customer['cadd'])
print('Mobile:\t\t\t', customer['mob'])
print('Adhar:\t\t\t', customer['adhar'])
print('Check In Date:\t\t', customer['checkin'])
print('Total no of Days:\t', customer['days'])
print('Total Fare:\t\t', customer['totalfare'])
def Bill_print():
#open file in binary mode for reading
try:
infile = open('customer.dat', 'rb')
except FileNotFoundError:
print('No record found..')
print('Go to admin menu to create record')
return
found = False
roomno = int(input('Enter the Room No you want to print bill: '))
#read to the end of file.
while True:
try:
#reading the oject from file
customer = pickle.load(infile)

if customer['roomno'] == roomno:
#display the record
display_data_tabular(customer)
found = True
break
except EOFError:
break
if found==False:
print('Record not found!!')
#close the file
infile.close()

def write_record():
#open file in binary mode for writing.
outfile = open('customer.dat', 'ab')

while(True):
#serialize the record and writing to file
pickle.dump(set_data(), outfile)
ans = input('Wants to enter more record (y/n)?: ')
if ans in 'nN':
break

#close the file


outfile.close()

def read_records():
#open file in binary mode for reading
try:
infile = open('customer.dat', 'rb')
except FileNotFoundError:
print('No record found..')
return

#read to the end of file.


while True:
try:
#reading the oject from file
customer = pickle.load(infile)

#display the record


display_data(customer)
except EOFError:
break

#close the file


infile.close()

def search_record():
#open file in binary mode for reading
try:
infile = open('customer.dat', 'rb')
except FileNotFoundError:
print('No record..')
return

found = False
roomno = int(input('Enter the Room No you want to search: '))
#read to the end of file.
while True:
try:
#reading the oject from file
customer = pickle.load(infile)
if customer['roomno'] == roomno:
#display the record
display_data(customer)
found = True
break
except EOFError:
break
if found==False:
print('Record not found!!')

#close the file


infile.close()

def delete_record():
try:
infile = open('customer.dat', 'rb')
except FileNotFoundError:
print('No record found to delete..')
return

outfile = open("temp.dat","wb")
found = False

roomno = int(input('Enter Room Number: '))


while True:
try:
#reading the oject from file
customer = pickle.load(infile)

#display record if found and set flag


if customer['roomno'] == roomno:
display_data(customer)
found = True
break
else:
pickle.dump(customer,outfile)
except EOFError:
break

if found == False:
print('Record not Found')
print()
else:
print("record found and deleted")
infile.close()
outfile.close()
os.remove("customer.dat")
os.rename("temp.dat","customer.dat")

def modify_record():
print('\nMODIFY RECORD')
try:
infile = open('customer.dat', 'rb')
except FileNotFoundError:
print('No record found to modify..')
return

found = False
outfile = open("temp.dat","wb")
roomno = int(input('Enter Room Number: '))
while True:
try:
#reading the oject from file
customer = pickle.load(infile)

#display record if found and set flag


if customer['roomno'] == roomno:

print('Name:',customer['cname'])
ans=input('Wants to edit(y/n)? ')
if ans in 'yY':
customer['cname'] = input("Enter the name ")

print('Customer Address:',customer['cadd'])
ans=input('Wants to edit(y/n)? ')
if ans in 'yY':
customer['cadd'] = input("Enter New Address: ")

print('Mobile No:',customer['mob'])
ans=input('Wants to edit(y/n)? ')
if ans in 'yY':
customer['mob'] = input("Enter new mobile number: ")

print('Adhar Card No:',customer['adhar'])


ans=input('Wants to edit(y/n)? ')
if ans in 'yY':
customer['adhar'] = input("Enter new adhar Number: ")

print('Check In Date:',customer['checkin'])
ans=input('Wants to edit(y/n)? ')
if ans in 'yY':
customer['checkin'] = input("Enter new Date: ")

pickle.dump(customer,outfile)
found = True
break
else:
pickle.dump(customer,outfile)
except EOFError:
break
if found == False:
print('Record not Found')
else:
print('Record Updated')
display_data(customer)

infile.close()
outfile.close()
os.remove("customer.dat")
os.rename("temp.dat","customer.dat")

def intro():
print("=x=x=x=x=x=x=x=x=x=x=x=x=x=x=x=x=x=x=x=x=")
print(" Hotel Management System")
print(" Billing System")
print(" PROJECT")
print("SCHOOL : SARASWATI VIDYA MANDIR, ETAH")
print("=x=x=x=x=x=x=x=x=x=x=x=x=x=x=x=x=x=x=x=x=")
print()
time.sleep(1)

def main_menu():
print("\nMAIN MENU")
print("1. PRINT BILL")
print("2. ADMIN MENU")
print("3. EXIT")

def admin_menu():
print("ADMIN MENU")
print("1. ADD NEW CUSTOMER RECORD")
print("2. DISPLAY ALL CUSTOMERS RECORDS")
print("3. SEARCH CUSTOMER RECORD ")
print("4. MODIFY CUSTOMER RECORD ")
print("5. DELETE CUSTOMER RECORD ")
print("6. BACK TO MAIN MENU")

def main():
intro()
while(True):
main_menu()
choice = input('Enter choice(1-3): ')
print()

if choice == '1':
Bill_print()

elif choice == '2':


admin_menu()
echoice = input('Enter choice(1-6): ')
if echoice == '1':
write_record()
elif echoice == '2':
read_records()
elif echoice == '3':
search_record()
elif echoice == '4':
modify_record()
elif echoice == '5':
delete_record()
elif echoice == '6':
pass
else:
print('Invalid Input !!!')
print()

elif choice == '3':


break
else:
print('Invalid Input!!!')
print()

#call the main function.


main()
OUTPUT
Main Menu
Print Bill
Admin Menu
Add New Customer Record
Display All Customer Records
Search Customer Record
Modify Customer Record
Delete Customer Record
Back To Main Menu
Exit

You might also like