Simple Food and Drinks ordering System

Simple Food and Drinks ordering System



Source Code:- 

 
001
002
003
004
005
006
007
008
009
010
011
012
013
014
015
016
017
018
019
020
021
022
023
024
025
026
027
028
029
030
031
032
033
034
035
036
037
038
039
040
041
042
043
044
045
046
047
048
049
050
051
052
053
054
055
056
057
058
059
060
061
062
063
064
065
066
067
068
069
070
071
072
073
074
075
076
077
078
079
080
081
082
083
084
085
086
087
088
089
090
091
092
093
094
095
096
097
098
099
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
# FOOD ORDERING SYSTEM USING PYTHON
# Made by:- @python_with_shubham
 
def food_ordering_system():
    print("\n================ FOOD ORDERING SYSTEM ================\n")
     
    # take customer details by user
    def customer_details():
        global Name, Address, Phone, Email
        Name = input("Enter Your Name: ")
        Address = input("Enter Your Address: ")
        Phone = input("Enter Your Phone Number: ")
        Email = input("Enter Your Email: ")
        print("\n---Your Menu of Foods and Drinks---")
        if Name=="" or Address=="" or Phone=="" or Email=="":
            print("Please Enter All Customer details.")
            customer_details()
    customer_details()
 
    # read and display the menu contents
    def read_menuFile():
        with open('D:/PYTHON MODULES/Food Ordering System without GUI/Foods and Drinks Menu List.txt') as f:
            contents = f.read()
            print(contents)
    read_menuFile()
 
    # save customer details in text file
    def save_customerData():
        file1 = open("D:/PYTHON MODULES/Food Ordering System without GUI/Order.txt", "w")
        file1.write("  Name      :   " + Name)
        file1.write("\n Address    :   " + Address)
        file1.write("\n  Phone     :   " + Phone)
        file1.write("\n  Email     :   " + Email)
        file1.close()
    save_customerData()
 
    # place order by user
    def order_placing():
        print("\n----------Place Your Order-----------")
        def foods():
            global food, item_name1, item_price1
            food = input("Select a item from Foods: ")
            if len(food) == 1:
         
                if food == "1":
                    item_name1 = "French Fries"
                    item_price1 = 50.00
                    file1 = open("D:/PYTHON MODULES/Food Ordering System without GUI/Order.txt", "a")
                    file1.write("\nFood Item   :  " + f"{item_name1}")
                    file1.write("\nFood Price  :  " + f"Rs{item_price1}")
                    file1.close()
 
                elif food == "2":
                    item_name1 = "Cheese Burger"
                    item_price1 = 100.00
                    file1 = open("D:/PYTHON MODULES/Food Ordering System without GUI/Order.txt", "a")
                    file1.write("\nFood Item   :  " + f"{item_name1}")
                    file1.write("\nFood Price  :  " + f"Rs{item_price1}")
                    file1.close()
 
                elif food == "3":
                    item_name1 = "Burger"
                    item_price1 = 80.00
                    file1 = open("D:/PYTHON MODULES/Food Ordering System without GUI/Order.txt", "a")
                    file1.write("\nFood Item   :  " + f"{item_name1}")
                    file1.write("\nFood Price  :  " + f"Rs{item_price1}")
                    file1.close()
 
                elif food == "4":
                    item_name1 = "Pizza"
                    item_price1 = 150.00
                    file1 = open("D:/PYTHON MODULES/Food Ordering System without GUI/Order.txt", "a")
                    file1.write("\nFood Item   :  " + f"{item_name1}")
                    file1.write("\nFood Price  :  " + f"Rs{item_price1}")
                    file1.close()
            else:
                print("Your Order not Found in Foods. Please Enter Your Order Again.\n")
                foods()
        foods()
 
        def drinks():
            global drink, item_name2, item_price2
            drink = input("Select a item from Drinks: ")
            if len(drink) == 1:
 
                if drink == "1":
                    item_name2 = "Thums Up"
                    item_price2 = 30.00
                    file1 = open("D:/PYTHON MODULES/Food Ordering System without GUI/Order.txt", "a")
                    file1.write("\nDrinks Item   :  " + f"{item_name2}")
                    file1.write("\nDrinks Price  :  " + f"Rs{item_price2}")
                    file1.close()
 
                elif drink == "2":
                    item_name2 = "Pepsi"
                    item_price2 = 30.00
                    file1 = open("D:/PYTHON MODULES/Food Ordering System without GUI/Order.txt", "a")
                    file1.write("\nDrinks Item   :  " + f"{item_name2}")
                    file1.write("\nDrinks Price  :  " + f"Rs{item_price2}")
                    file1.close()
 
                elif drink == "3":
                    item_name2 = "Mazza"
                    item_price2 = 35.00
                    file1 = open("D:/PYTHON MODULES/Food Ordering System without GUI/Order.txt", "a")
                    file1.write("\nDrinks Item   :  " + f"{item_name2}")
                    file1.write("\nDrinks Price  :  " + f"Rs{item_price2}")
                    file1.close()
 
                elif drink == "4":
                    item_name2 = "Fanta"
                    item_price2 = 20.00
                    file1 = open("D:/PYTHON MODULES/Food Ordering System without GUI/Order.txt", "a")
                    file1.write("\nDrinks Item   :  " + f"{item_name2}")
                    file1.write("\nDrinks Price  :  " + f"Rs{item_price2}")
                    file1.close()
            else:
                print("Your Order not Found in Drinks. Please Enter Your Order Again.\n")
                drinks()
        drinks()
    order_placing()
                 
    # read Order.txt file and calculate the total payment
    def payment():
        global item_name1, item_name2, item_price1, item_price2
        with open('D:/PYTHON MODULES/Food Ordering System without GUI/Order.txt') as f:
            Customer_data = f.read()
             
            print("\n-------Customer & Order Details------")
            print(Customer_data)
            print("\n-----------Payment Receipt-----------")
         
            print(f"Price of {item_name1} = Rs{item_price1}")
            print(f"Price of {item_name2} = Rs{item_price2}")
 
            delivery_charges =  50.00
            print(f"Delivery Charges = Rs{delivery_charges}")
 
            total_price = item_price1 + item_price2 + delivery_charges
            print(f"Total Payable Amount = Rs{total_price}")
 
            print("-------------------------------------\n")
    payment()
 
food_ordering_system() # called the food_ordering_system function
 
 
# FOOD ORDERING SYSTEM USING PYTHON
# Made by:- @python_with_shubham

def food_ordering_system():
    print("\n================ FOOD ORDERING SYSTEM ================\n")
    
    # take customer details by user
    def customer_details():
        global Name, Address, Phone, Email
        Name = input("Enter Your Name: ")
        Address = input("Enter Your Address: ")
        Phone = input("Enter Your Phone Number: ")
        Email = input("Enter Your Email: ")
        print("\n---Your Menu of Foods and Drinks---")
        if Name=="" or Address=="" or Phone=="" or Email=="":
            print("Please Enter All Customer details.")
            customer_details()
    customer_details()

    # read and display the menu contents
    def read_menuFile():
        with open('D:/PYTHON MODULES/Food Ordering System without GUI/Foods and Drinks Menu List.txt') as f:
            contents = f.read()
            print(contents)
    read_menuFile()

    # save customer details in text file
    def save_customerData():
        file1 = open("D:/PYTHON MODULES/Food Ordering System without GUI/Order.txt", "w")
        file1.write("  Name      :   " + Name)
        file1.write("\n Address    :   " + Address)
        file1.write("\n  Phone     :   " + Phone)
        file1.write("\n  Email     :   " + Email)
        file1.close()
    save_customerData()

    # place order by user
    def order_placing():
        print("\n----------Place Your Order-----------")
        def foods():
            global food, item_name1, item_price1
            food = input("Select a item from Foods: ")
            if len(food) == 1:
        
                if food == "1":
                    item_name1 = "French Fries"
                    item_price1 = 50.00 
                    file1 = open("D:/PYTHON MODULES/Food Ordering System without GUI/Order.txt", "a")
                    file1.write("\nFood Item   :  " + f"{item_name1}")
                    file1.write("\nFood Price  :  " + f"Rs{item_price1}")
                    file1.close()

                elif food == "2":
                    item_name1 = "Cheese Burger"
                    item_price1 = 100.00 
                    file1 = open("D:/PYTHON MODULES/Food Ordering System without GUI/Order.txt", "a")
                    file1.write("\nFood Item   :  " + f"{item_name1}")
                    file1.write("\nFood Price  :  " + f"Rs{item_price1}")
                    file1.close()

                elif food == "3":
                    item_name1 = "Burger"
                    item_price1 = 80.00 
                    file1 = open("D:/PYTHON MODULES/Food Ordering System without GUI/Order.txt", "a")
                    file1.write("\nFood Item   :  " + f"{item_name1}")
                    file1.write("\nFood Price  :  " + f"Rs{item_price1}")
                    file1.close()

                elif food == "4":
                    item_name1 = "Pizza"
                    item_price1 = 150.00 
                    file1 = open("D:/PYTHON MODULES/Food Ordering System without GUI/Order.txt", "a")
                    file1.write("\nFood Item   :  " + f"{item_name1}")
                    file1.write("\nFood Price  :  " + f"Rs{item_price1}")
                    file1.close()
            else:
                print("Your Order not Found in Foods. Please Enter Your Order Again.\n")
                foods()
        foods()

        def drinks():
            global drink, item_name2, item_price2
            drink = input("Select a item from Drinks: ")
            if len(drink) == 1:

                if drink == "1":
                    item_name2 = "Thums Up"
                    item_price2 = 30.00
                    file1 = open("D:/PYTHON MODULES/Food Ordering System without GUI/Order.txt", "a")
                    file1.write("\nDrinks Item   :  " + f"{item_name2}")
                    file1.write("\nDrinks Price  :  " + f"Rs{item_price2}")
                    file1.close()

                elif drink == "2":
                    item_name2 = "Pepsi"
                    item_price2 = 30.00
                    file1 = open("D:/PYTHON MODULES/Food Ordering System without GUI/Order.txt", "a")
                    file1.write("\nDrinks Item   :  " + f"{item_name2}")
                    file1.write("\nDrinks Price  :  " + f"Rs{item_price2}")
                    file1.close()

                elif drink == "3":
                    item_name2 = "Mazza"
                    item_price2 = 35.00
                    file1 = open("D:/PYTHON MODULES/Food Ordering System without GUI/Order.txt", "a")
                    file1.write("\nDrinks Item   :  " + f"{item_name2}")
                    file1.write("\nDrinks Price  :  " + f"Rs{item_price2}")
                    file1.close()

                elif drink == "4":
                    item_name2 = "Fanta"
                    item_price2 = 20.00
                    file1 = open("D:/PYTHON MODULES/Food Ordering System without GUI/Order.txt", "a")
                    file1.write("\nDrinks Item   :  " + f"{item_name2}")
                    file1.write("\nDrinks Price  :  " + f"Rs{item_price2}")
                    file1.close()
            else:
                print("Your Order not Found in Drinks. Please Enter Your Order Again.\n")
                drinks()
        drinks()
    order_placing()
                
    # read Order.txt file and calculate the total payment
    def payment():
        global item_name1, item_name2, item_price1, item_price2
        with open('D:/PYTHON MODULES/Food Ordering System without GUI/Order.txt') as f:
            Customer_data = f.read()
            
            print("\n-------Customer & Order Details------")
            print(Customer_data)
            print("\n-----------Payment Receipt-----------")
        
            print(f"Price of {item_name1} = Rs{item_price1}")
            print(f"Price of {item_name2} = Rs{item_price2}")

            delivery_charges =  50.00
            print(f"Delivery Charges = Rs{delivery_charges}")

            total_price = item_price1 + item_price2 + delivery_charges
            print(f"Total Payable Amount = Rs{total_price}")

            print("-------------------------------------\n")
    payment()

food_ordering_system() # called the food_ordering_system function


Output:- 


Menu.txt:-



Order.txt:- 



Follow me on Instagram:- Python_with_Shubham


0 Comments