Generation

generate functionFri, 10 Feb 2023

You have to design a Food Ordering app for a restaurant The application will have a log-in for admin and users to log-in -------------------------------- Admin ---------------------------------- ➑️ Admin will have the following functionalities: ⬅️ πŸ‘‰ 1. Add new food items. Food Item will have the following details: πŸ”΄ FoodID //It should be generated automatically by the application. πŸ”΄ Name πŸ”΄ Quantity. For eg, 100ml, 250gm, 4pieces etc πŸ”΄ Price πŸ”΄ Discount πŸ”΄ Stock. Amount left in stock in the restaurant. πŸ‘‰ 2. Edit food items using FoodID. πŸ‘‰ 3. View the list of all food items. πŸ‘‰ 4. Remove a food item from the menu using FoodID. --------------------------------- User ---------------------------------- ➑️ The user will have the following functionalities: ⬅️ πŸ‘‰ 1. Register on the application. Following to be entered for registration: πŸ”΄ Full Name πŸ”΄ Phone Number πŸ”΄ Email πŸ”΄ Address πŸ”΄ Password πŸ‘‰ 2. Log in to the application πŸ‘‰ 3. The user will see 3 options: πŸ”΄ Place New Order πŸ”΄ Order History πŸ”΄ Update Profile πŸ‘‰ 4. Place New Order: The user can place a new order at the restaurant. πŸ”΅ Show list of food. The list item should as follows: πŸ”΄ Tandoori Chicken (4 pieces) [INR 240] πŸ”΄ Vegan Burger (1 Piece) [INR 320] πŸ”΄ Truffle Cake (500gm) [INR 900] πŸ‘‰ 5. Users should be able to select food by entering an array of numbers. For example, if the user wants to order Vegan Burger and Truffle Cake they should enter [2, 3] πŸ‘‰ 6. Once the items are selected user should see the list of all the items selected. The user will also get an option to place an order. πŸ‘‰ 7. Order History should show a list of all the previous orders

# Python 3.7 import random #global variables #food_list = [] #functions def get_food_id(): return random.randint(1000,9999) def add_food_items(food_list, food_name, qty, price, discount, stock): food_list.append({ "FoodID": get_food_id(), "Name": food_name, "Quantity": qty, "Price": price, "Discount": discount, "Stock": stock, }) def edit_food_items(food_list, food_id, new_food_name, new_qty, new_price, new_discount, new_stock): for food in food_list: if food["FoodID"] == food_id: food["Name"] = new_food_name food["Quantity"] = new_qty food["Price"] = new_price food["Discount"] = new_discount food["Stock"] = new

Questions about programming?Chat with your personal AI assistant