PYTHON SOURCE CODE
PYTHON SOURCE CODE
import platform
import mysql.connector
class HotelManagementSystem:
def __init__(self):
self.mydb = mysql.connector.connect(
self.mycursor = self.mydb.cursor()
self.restaurant_bill = 0
self.laundry_bill = 0
def register_customer(self):
try:
sql = "INSERT INTO custdata(custname, addr, indate, outdate) VALUES (%s, %s, %s, %s)"
self.mydb.commit()
except Exception as e:
print(f"Error: {e}")
def view_room_types(self):
try:
print(row)
except Exception as e:
print(f"Error: {e}")
def calculate_room_rent(self):
try:
if choice in rates:
return rent
else:
return 0
except ValueError:
return 0
def view_restaurant_menu(self):
try:
print("Restaurant menu:")
rows = self.mycursor.fetchall()
print(row)
except Exception as e:
print(f"Error: {e}")
def order_item(self):
self.view_restaurant_menu()
menu = {
try:
if choice in menu:
self.restaurant_bill += cost
else:
def calculate_laundry_bill(self):
try:
self.laundry_bill = clothes * 10
except ValueError:
def generate_bill(self):
def menu(self):
while True:
print("8. Exit")
try:
if choice == 1:
self.register_customer()
elif choice == 2:
self.view_room_types()
elif choice == 3:
self.calculate_room_rent()
elif choice == 4:
self.view_restaurant_menu()
elif choice == 5:
self.order_item()
elif choice == 6:
self.calculate_laundry_bill()
elif choice == 7:
self.generate_bill()
elif choice == 8:
break
else:
except ValueError:
if __name__ == "__main__":
system = HotelManagementSystem()
system.menu()