Mubeen
Mubeen
HARDWARE:
CPU:
A minimum of 2 CPU cores is recommended for basic
operations.
For more intensive applications, consider a configuration with 4 or more
CPU cores.
RAM:
At least 2 GB of RAM is necessary for minimal operations.
For better performance, particularly with larger datasets or more
concurrent connections, aim for 8 GB of RAM or more.
DISK SPACE:
Ensure sufficient disk space to accommodate the MySQL Server
installation and any databases you may create. This requirement can
vary widely based on your specific use case.
SOFTWARE:
PYTHON VERSION:
Python must be installed (versions 3.6 and higher are generally
supported) and included in your system's PATH.
MYSQL VERSION:
MySQL Server should be installed on your machine. The version
should ideally be compatible with the version of MySQL
Connector/Python you are using (e.g., Connector/Python 8.0 is
compatible with MySQL Server 8.0 and higher).
INDEX
3. ADVANTAGES
5. SOURCE CODE
6. OUTPUT
customer experience.
Improved Decision Making:
customer retention.
Cost Reduction:
systems.
Portfolio Enhancement:
FUNCTIONS:
1. Database Connection:
2. Menu Management:
3. Order Management:
# Menu-driven program
def main():
conn = connect_to_db()
if conn:
create_tables(conn)
while True:
print("\nRestaurant Management System")
print("-------------------------------")
print("1. Add/View Menu")
print("2. Place Order")
print("3. View Orders")
print("4. Exit")
choice = input("Enter your choice: ")
if choice == "1":
add_view_menu(conn)
elif choice == "2":
place_order(conn)
elif choice == "3":
view_orders(conn)
elif choice == "4":
break
else:
print("Invalid choice. Please try again.")
# Add/View Menu
def add_view_menu(conn):
print("\nMenu Management")
print("----------------")
print("1. Add Dish")
print("2. View Menu")
print("3. Back")
choice = input("Enter your choice: ")
if choice == "1":
dish_name = input("Enter dish name: ")
price = float(input("Enter price: "))
cursor = conn.cursor()
cursor.execute("INSERT INTO menu (dish_name, price) VALUES
(%s, %s)", (dish_name, price))
conn.commit()
print("Dish added successfully!")
elif choice == "2":
cursor = conn.cursor()
cursor.execute("SELECT * FROM menu")
menu = cursor.fetchall()
print("\nMenu:")
for dish in menu:
print(f"{dish[0]}. {dish[1]} - {dish[2]}")
# Place Order
def place_order(conn):
print("\nPlace Order")
print("------------")
customer_name = input("Enter customer name: ")
order_date = input("Enter order date (YYYY-MM-DD): ")
cursor = conn.cursor()
cursor.execute("INSERT INTO orders (customer_name,
order_date) VALUES (%s, %s)", (customer_name, order_date))
order_id = cursor.lastrowid
conn.commit()
print("Order placed successfully!")
add_order_items(conn, order_id)
# View Orders
def view_orders(conn):
print("\nView Orders")
print("------------")
cursor = conn.cursor()
cursor.execute("SELECT * FROM orders")
orders = cursor.fetchall()
print("\nOrders:")
for order in orders:
print(f"Order ID: {order[0]} - Customer: {order[1]} - Date:
{order[2]}")
cursor.execute("SELECT * FROM order_items WHERE order_id
= %s
OUTPUT
Initial Output
Add/View Menu
Menu Management
----------------
1. Add Dish
2. View Menu
3. Back
Enter your choice: 1
Enter dish name: Chicken Biryani
Enter price: 150.00
Dish added successfully!
Menu Management
----------------
1. Add Dish
2. View Menu
3. Back
Enter your choice: 2
Menu:
1. Chicken Biryani - 150.00
2. Veg Pizza - 100.00
3. Chicken Burger - 120.00
Place Order
Place Order
------------
Enter customer name: John Doe
Enter order date (YYYY-MM-DD): 2024-11-19
View Orders
View Orders
------------
Orders:
Order ID: 1 - Customer: John Doe - Date: 2024-11-19
- Chicken Biryani x 2
Order ID: 2 - Customer: Jane Doe - Date: 2024-11-18
- Veg Pizza x 1
Exit
TOPPR
BRAINLY
EDUREV
MERITNATION
UNACADEMY
SARTHAKS
DOUBTNUT
TEACHOO