Skip to content
TheChatArchiveThe Chat Archive
gpt-3.5-turbo-0301· OpenAIAi2 WildChat-4.8M (AI2)

You will choose one restaurant and research the prices of some menu items. More…

  1. User

    You will choose one restaurant and research the prices of some menu items. More specifically, you will choose: 3-5 Beverages 5 Main Menu Items (keep it simple - avoid “build your own” kinds of items) 3-5 Sides/Snacks

    You should use the names and prices listed from the menus on the site you chose.

    Your program will display the purchasing options and prompt the user to select an item from each category, or checkout. For example your prompt could look like this:

    Choose a main menu item Choose a beverage Choose a side/snack Checkout

    If the user selects option “1”, proceed to print out the main menu options and prices. Same for option 2, or option 3. Print out the food options and their prices.

    The user should be continuously prompted to select mains, beverages, and sides until they select the option to “checkout”. At the checkout, you should determine how many combos can be made.

    A combo consists of one main item, one beverage, and one side/snack. For each combo, a 5% discount should be applied to the total cost of the order. The user should be provided with a list of the items they purchased, the total applicable discount amount, number of combos in the order, and the total cost of all the items before and after tax.

    As an example, assume the user selects the following items at A&W:

    Root Beer (beverage) Onion Rings (side/snack) Teen Burger (Main menu) Mama Burger (Main menu)

    Help me code this: there is only 1 combo that can be created, so the total discount would be 5%. A combo contains of 3 items from different categories: example includes one side, one main menu item, and one beverage

    In this example: Root Beer (beverage) Onion Rings (side/snack) Teen Burger (Main menu) Mama Burger (Main menu) Sweet Potato Fries (side/snack) Orange Juice (beverage) Onion Rings (side/snack)

    Then there are 2 combos and one extra side, so the total discount is 10%.

    Your program should make use of 5 functions: one main function this function prints out the relevant information about the program and continuously prompts the user to purchase items, or checkout three functions for the menu options One function for main menu items, one function for snacks, and one function for beverages. These functions are responsible for prompting the user to select one type of item and will return the item that gets returned one function that completes the checkout process This function processes the items purchased, determines the number of combos and applicable discounts, calculates the total costs (before/after tax) and prints the itemized receipt.

  2. Assistant

    Function to display menu options for main menu items

    def main_menu(): print("MAIN MENU ITEMS: ") print("1. Cheeseburger - 5.99")print("2.ChickenSandwich−5.99") print("2. Chicken Sandwich - 6.99") print("3. Hot Dog - 4.99")print("4.VeggieBurger−4.99") print("4. Veggie Burger - 5.99") print("5. Fish Sandwich - $7.99") selection = int(input("Enter the number of the main menu item you want to order: ")) if selection == 1: return "Cheeseburger" elif selection == 2: return "Chicken Sandwich" elif selection == 3: return "Hot Dog" elif selection == 4: return "Veggie Burger" elif selection == 5: return "Fish Sandwich" else: print("Invalid selection") return main_menu()

    Function to display menu options for snacks/sides

    def snacks_sides(): print("SNACKS/SIDES: ") print("1. French Fries - 2.49")print("2.OnionRings−2.49") print("2. Onion Rings - 3.49") print("3. Sweet Potato Fries - 3.99")print("4.GardenSalad−3.99") print("4. Garden Salad - 4.99") print("5. Caesar Salad - $5.99") selection = int(input("Enter the number of the snack/side you want to order: ")) if selection == 1: return "French Fries" elif selection == 2: return "Onion Rings" elif selection == 3: return "Sweet Potato Fries" elif selection == 4: return "Garden Salad" elif selection == 5: return "Caesar Salad" else: print("Invalid selection") return snacks_sides()

    Function to display menu options for beverages

    def beverages(): print("BEVERAGES: ") print("1. Coke - 1.99")print("2.Sprite−1.99") print("2. Sprite - 1.99") print("3. Root Beer - 1.99")print("4.Lemonade−1.99") print("4. Lemonade - 2.29") print("5. Orange Juice - $2.49") selection = int(input("Enter the number of the beverage you want to order: ")) if selection == 1: return "Coke" elif selection == 2: return "Sprite" elif selection == 3: return "Root Beer" elif selection == 4: return "Lemonade" elif selection == 5: return "Orange Juice" else: print("Invalid selection") return beverages()

    Function to complete checkout process

    def checkout(items): menu_prices = {"Cheeseburger": 5.99, "Chicken Sandwich": 6.99, "Hot Dog": 4.99, "Veggie Burger": 5.99, "Fish Sandwich": 7.99} snacks_sides_prices = {"French Fries": 2.49, "Onion Rings": 3.49, "Sweet Potato Fries": 3.99, "Garden Salad": 4.99, "Caesar Salad": 5.99} beverages_prices = {"Coke": 1.99, "Sprite": 1.99, "Root Beer": 1.99, "Lemonade": 2.29, "Orange Juice": 2.49} total_cost = 0 combos = 0 for item in items: if item in menu_prices: total_cost += menu_prices[item] elif item in snacks_sides_prices: total_cost += snacks_sides_prices[item] elif item in beverages_prices: total_cost += beverages_prices[item] num_combs = min(items.count("Cheeseburger"), items.count("Chicken Sandwich"), items.count("Fish Sandwich")) combos += num_combs total_cost -= num_combs * 0.05 * total_cost sides = items.count("French Fries") + items.count("Onion Rings") + items.count("Sweet Potato Fries") + items.count("Garden Salad") + items.count("Caesar Salad") if sides >= 2: total_cost -= 0.05 * total_cost total_cost += 0.13 * total_cost # add tax print("\n---RECEIPT---") for item in items: print(item) print("Number of Combos:", combos) print("Discount:", "{:.2f}".format((1 - (total_cost / sum(menu_prices.values() + snacks_sides_prices.values() + beverages_prices.values()))) * 100), "%") print("Total Before Tax:", ":.2f".format(totalcost/1.13))print("TotalAfterTax:","{:.2f}".format(total_cost / 1.13)) print("Total After Tax:", "{:.2f}".format(total_cost))

    Main function to prompt user for order

    def main(): print("---Welcome to the Restaurant Order System---") print("Please enter the item number to add it to your order, or type "checkout" to complete your order.") items = [] while True: print("\n---MENU OPTIONS---") print("1. Main Menu") print("2. Snacks/Sides") print("3. Beverages") print("4. Checkout") selection = input("Enter the number of the menu option you want: ") if selection == "1": item = main_menu() items.append(item) print(item, "has been added to your order.") elif selection == "2": item = snacks_sides() items.append(item) print(item, "has been added to your order.") elif selection == "3": item = beverages() items.append(item) print(item, "has been added to your order.") elif selection == "4": checkout(items) break else: print("Invalid selection")

    if name == "main": main()