0% found this document useful (0 votes)
10 views

Code

Python file Python code Practical

Uploaded by

Parth Agnihotri
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views

Code

Python file Python code Practical

Uploaded by

Parth Agnihotri
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

# Restaurant Management System with Indian Menu and Billing

class Restaurant:

def __init__(self):

# Indian menu with items and their prices (in Indian Rupees)

self.menu = {

"Masala Dosa": 80.00,

"Paneer Tikka": 150.00,

"Butter Naan": 25.00,

"Dal Makhani": 120.00,

"Chole Bhature": 90.00,

"Lassi": 40.00,

"Biryani": 180.00,

"Samosa": 15.00,

"Gulab Jamun": 20.00,

"Veg Thali": 200.00

self.order = {} # To store ordered items and their quantities

def show_menu(self):

# Display the menu items and prices

print("\n--- Menu ---")

for item, price in self.menu.items():

print(f"{item}: ₹{price:.2f}")

def take_order(self):

while True:

self.show_menu()

item = input("\nEnter the item you want to order (or type 'done' to finish): ").capitalize()

# Exit loop if done


if item.lower() == 'done':

break

# Check if item is on the menu

if item in self.menu:

try:

quantity = int(input(f"Enter the quantity for {item}: "))

# Add item to order, update quantity if item already exists

if item in self.order:

self.order[item] += quantity

else:

self.order[item] = quantity

print(f"{quantity} {item}(s) added to your order.")

except ValueError:

print("Invalid quantity. Please enter a number.")

else:

print("Sorry, we don't have that item. Please choose from the menu.")

def calculate_bill(self):

# Calculate the total bill

total = 0

print("\n--- Order Summary ---")

for item, quantity in self.order.items():

price = self.menu[item]

cost = price * quantity

total += cost

print(f"{item} (x{quantity}): ₹{cost:.2f}")

print(f"\nTotal Bill: ₹{total:.2f}")

return total

def run(self):
# Run the restaurant management system

print("Welcome to our Restaurant!")

self.take_order()

self.calculate_bill()

print("\nThank you for dining with us!")

# Run the program

restaurant = Restaurant()

restaurant.run()

You might also like