Hotel Management
Hotel Management
Hotel Management
DATABASE MANAGEMENT
WITH PYTHON
About MySQL
MySQL is an open-source relational database management system (RDBMS). . A
relational database organizes data into one or more data tables in which data types
may be related to each other; these relations help structure the data. SQL is a
language programmers use to create, modify, and extract data from the relational
database, as well as control user access to the database.
SUDHARSAN J
XII – C2
ABOUT THE PROJECT
EXPLANATION:
Importing the Library
import mysql.connector
This line imports the mysql.connector library, which is used to connect
and interact with a MySQL database from Python
This function collects customer details through user input, stores them in a
list L, converts the list to a tuple cust, and inserts the data into the cust data table.
This function displays available room types if the user chooses to see them.
Room Rent Calculation
def roomrent():
print("We have the following rooms for you:")
print("1. Type A - Rs 1000 per night")
print("2. Type B - Rs 2000 per night")
print("3. Type C - Rs 3000 per night")
print("4. Type D - Rs 4000 per night")
if x == 1:
s = 1000 * n
elif x == 2:
s = 2000 * n
elif x == 3:
s = 3000 * n
elif x == 4:
s = 4000 * n
else:
print("Please choose a valid room type")
return
print("Your room rent is Rs", s)
This function calculates the room rent based on the user's choice and the number
of nights stayed.
Restaurant Menu View
def restaurentmenuview():
print("Do you want to see the menu available? Enter 1 for yes:")
ch = int(input("Enter your choice: "))
if ch == 1:
sql = "SELECT * FROM restaurent"
mycursor.execute(sql)
rows = mycursor.fetchall()
for x in rows:
print(x)
This function displays the restaurant menu if the user chooses to see it.
print("Do you want to purchase from the above list? Enter your choice:")
d = int(input("Enter your choice: "))
if d == 1:
a = int(input("Enter quantity: "))
s = 10 * a
print("Your amount for tea is Rs", s)
elif d == 2:
a = int(input("Enter quantity: "))
s = 10 * a
print("Your amount for coffee is Rs", s)
else:
print("Please enter your choice from the menu")
This function lets the user order items from the restaurant menu and calculates the
total amount based on the quantity.
Laundry Bill Calculation
def laundarybill():
global z
print("Do you want to see the rate for laundry? Enter 1 for yes:")
ch = int(input("Enter your choice: "))
if ch == 1:
sql = "SELECT * FROM laundary"
mycursor.execute(sql)
rows = mycursor.fetchall()
for x in rows:
print(x)
This function calculates the laundry bill based on the number of clothes
This loop provides a menu to interact with the various functions of the hotel
management system
OUTPUT:
THANK
YOU