Created
November 27, 2019 08:27
-
-
Save yogesh-aggarwal/397197dffd5ed4d91544e6c8a12eefd2 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Hotel management system | |
""" | |
import time | |
import datetime | |
foodChoice = {} | |
activityChoice = {} | |
serviceCharge = 100 | |
checkIn = None | |
nop = None | |
data = [] | |
fileName = "data.kartik" | |
seperator = "*"*50 | |
def food(): | |
menu = { | |
"1) Water": 20, | |
"2) Tea": 30, | |
"3) Breakfast Standard Combo": 200, | |
"4) Breakfast Special Combo": 400, | |
"5) Lunch Standard Combo": 600, | |
"6) Lunch Special Combo": 700, | |
"7) Evening Snacks": 350, | |
"8) Dinner Standard Combo": 650, | |
"9) Dinner Special Combo": 770 | |
} | |
print("Food choices:") | |
for item in menu.keys(): | |
print(f"{item} -> {menu[item]}/-") | |
while True: | |
try: | |
# Getting list of keys (menu items) | |
menuList = list(menu.keys()) | |
# Getting inputs | |
ch = int(input("Choice: ")) | |
qu = int(input("Quantity: ")) | |
# Getting choice from the menu in proper form | |
key = menuList[ch-1] | |
# Total price of the choice | |
price = menu[key]*qu | |
foodChoice[key] = price | |
print("Successfully added!\n") | |
except: | |
break | |
def activity(): | |
menu = { | |
"1) Pool Billiards": 449, | |
"2) Bowling": 399, | |
"3) Table Tennis": 299, | |
"4) Fish Pedicure": 699, | |
"5) Virtual Rafting": 499 | |
} | |
details() | |
print("Activity choices:") | |
for item in menu.keys(): | |
print(f"{item} -> {menu[item]}/-") | |
while True: | |
try: | |
# Getting list of keys (menu items) | |
menuList = list(menu.keys()) | |
# Getting inputs | |
ch = int(input("Choice: ")) | |
qu = int(input("Persons: ")) | |
tm = int(input("Time (in hr): ")) | |
# Getting choice from the menu in proper form | |
key = menuList[ch-1] | |
# Total price of the choice | |
price = menu[key]*qu*tm | |
activityChoice[key] = price | |
print("Successfully added!\n") | |
except: | |
break | |
def total(): | |
global data | |
print("\nTotal Bill: ") | |
foodBill = 0 | |
activityBill = 0 | |
for i in list(foodChoice.values()): | |
foodBill += int(i) | |
for i in list(activityChoice.values()): | |
activityBill += int(i) | |
totalBill = activityBill + foodBill + serviceCharge | |
lst = [ | |
f"Bill for food: {foodBill}", | |
f"Bill for activity: {activityBill}", | |
f"Service charge: {serviceCharge}", | |
f"Total Bill: {totalBill}" | |
] | |
data.extend([f"{seperator}\n", f"Food Bill: {foodBill}\n", f"Activity Bill: {activityBill}\n", f"Service Charge: {serviceCharge}\n", f"Total Bill: {totalBill}\n", f"Check-in: {checkIn}\n", f"No. of people: {nop}\n", f"{seperator}\n"]) | |
for i in lst: | |
print(i) | |
file = open(fileName, "a+") | |
file.writelines(data) | |
file.close() | |
def details(): | |
global checkIn | |
checkIn = input(f"Name of person on whose name you want to check-in: ") | |
global nop | |
nop = int(input("No. of people: ")) | |
def showRecords(): | |
file = open(fileName, "r+") | |
readData = file.read() | |
file.close() | |
print(readData) | |
def showCommands(): | |
option = [ | |
seperator, | |
"1) Enter personal details", | |
"2) Create new food bill", | |
"3) Create new activity bill", | |
"4) Show total bill", | |
"5) Show previous records" | |
] | |
print() | |
for i in option: | |
print(i) | |
keyMap = { | |
"1": details, | |
"2": food, | |
"3": activity, | |
"4": total, | |
"5": showRecords | |
} | |
print("Welcome to our hotel!!!") | |
while True: | |
try: | |
showCommands() | |
command = input("\n> ") | |
keyMap[command]() | |
except: | |
continue |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment