Question

In: Computer Science

For python! You walk into a fast food restaurant and order fries, a burger, and a...

For python!

You walk into a fast food restaurant and order fries, a burger, and a drink. Create a simple text based user interactive program keeps track of the menu items you order. Use a dictionary to keep track of your menu items and price and another dictionary to keep track of your order and quantity.

 Fries are $3.50

 Burger are $5.00

 Drinks are $1.00

 Sales tax rate is 7.25%

menu = { "burger":5.00, "fries":3.50, "drink":1.00 }

order = { "burger":0, "fries":0, "drink":0 }

i. Use menu for the menu items and price. Use order to keep a running total of the number of items ordered.

ii. Keep a running subtotal.

iii. When all items are ordered, calculate the sales tax and total amount.

iv. Print a simple receipt.

v. See the assignment description for a sample video of how this might function.

Solutions

Expert Solution

Python Code for the given problem statement is as follows:

menu = { "burger":5.00, "fries":3.50, "drink":1.00 }
order = { "burger":0, "fries":0, "drink":0 }
subtotal=0.0

def orderFrom():
    global subtotal
    while True:
        print ("What you want to order today?\n1. Burger\n2. Fries\n3. Drink\n4. Done Ordering (Give me Receipt)")
        choice = int(input("Your Choice"))
        if choice==1:
            order["burger"]+=1
            subtotal=subtotal + menu["burger"]
        elif choice==2:
            order["fries"]+=1
            subtotal+=menu["fries"]
        elif choice==3:
            order["drink"]+=1
            subtotal+=menu["drink"]
        elif choice==4:
            printReceipt()
            break
        else:
            print("Wrong Input")

def printReceipt():
    global subtotal
    salesTax=7.25
    total=subtotal+(0.725*subtotal)
    print("\nYou ordered ",order["burger"]," Burgers + ",order["fries"]," Fries + ",order["drink"]," Drink(s)")
    print("Total Cost : ",total, " $")
    print("Visit Us Again")
    order["burger"]=0
    order["fries"]=0
    order["drink"]=0
    subtotal=0.0
    getOrderFunc()

def getOrderFunc():
    getOrder = input ("Do you want to order something(Y/N)?")
    if getOrder=='Y'or getOrder=='y':
        orderFrom()
    else:
        print ("Thanks for coming")
        exit()

getOrderFunc()
    

Output:

I Hope you find this solution helpful.

Keep Learning!


Related Solutions

For PYTHON You come into the fast food restaurant with a friend. Each of you orders...
For PYTHON You come into the fast food restaurant with a friend. Each of you orders separately, but everything will appear on one receipt. Print the total per cost person and the total of the receipt. Calculate the sales tax and print the total cost assuming the following prices: Fries are $3.50 Burger are $5.00 Drinks are $1.00 Sales tax rate is 7.25%
Burger King is a fast food restaurant that were in Indonesia in the 1990s re-emerged in...
Burger King is a fast food restaurant that were in Indonesia in the 1990s re-emerged in the country's culinary market. The retail company, PT Mitra Adiperkasa Tbk (MAP) is now the largest fast food restaurant licensee in the US and their competitor is McDonald. MAP added a new subsidiary on behalf of PT Sari Burger Indonesia to manage Burger King. MAP opened Burger King outlets in mid-2007. In their website, Burger King state that : Every day, more than 11...
Suppose the number of French fries in a small bag at a particular fast-food restaurant follows...
Suppose the number of French fries in a small bag at a particular fast-food restaurant follows a normal model with mean 49 fries and standard deviation 5 fries. 1. Estimate the proportion of the bags that contain at least 40 fries. 2. Estimate the proportion of the bags that contain 50 or fewer fries. 3. The restaurant could advertise that 99% of its bags contain at least how many fries? 4. If the restaurant wants to increase the probability in...
A fast-food restaurant uses an average of 110 grams of meat per burger patty. Suppose the...
A fast-food restaurant uses an average of 110 grams of meat per burger patty. Suppose the amount of meat in a burger patty is normally distributed with a standard deviation of 20 grams. What is the probability that the average amount of meat in four randomly selected burgers is less than 105 grams?
Imagine you're working for a fast-food restaurant. get details returns name of the burger and getPrice...
Imagine you're working for a fast-food restaurant. get details returns name of the burger and getPrice return the price of the meal. Java Using Decorator pattern make class BurgerToppings: -Each topping is an extra $1 and the name provided in the constructor -getTotalPrice: returns total price of burger + toppings -getDetails: returns the burger name + name of topping with the word (extra) Output expected: Ordering BigMac + extra pickles+ extra cheese Total price = 6.0 public interface Burger{ double...
Question is the following: Arena advertising: Burger Bills, a national fast food restaurant, purchases advertising rights...
Question is the following: Arena advertising: Burger Bills, a national fast food restaurant, purchases advertising rights to advertise in-ice during hockey games at Jensen Arena. Recall that Jensen Arena is still owned by the town of Springfield. In exchange for $60,000 per season, Burger Bills's logo will be displayed in the center ice for all games held at the Arena for 2 consecutive seasons. Burger Bill must pay for this rights at the beginning of each season. Four logos are...
Java Code. imagine you're working for a fast-food restaurant. get details returns name of the burger...
Java Code. imagine you're working for a fast-food restaurant. get details returns name of the burger and getPrice return the price of the meal. Using Decorator pattern make class BurgerToppings: -Each topping is an extra $1 and the name provided in the constructor -getTotalPrice: returns total price of burger + toppings -getDetails: returns the burger name + name of topping with the word (extra) Code: public interface Burger{ double C(); String getDetails(); } public class BigMac implements Burger{ private String...
KC, a fast-food restaurant, serves fried chicken, fried fish, and French fries. The managers have estimated...
KC, a fast-food restaurant, serves fried chicken, fried fish, and French fries. The managers have estimated the costs of a batch of fried chicken for KC's all-you-can-eat Friday Fried Fiesta. Each batch must be 100 pieces. The chicken is precut by the chain headquarters and sent to the stores in 10-piece bags. Each bag costs $3. Preparing a batch of 100 pieces of chicken with KC's special coating takes one employee two hours. The current wage rate is $8 per...
A fast-food restaurant determines the cost and revenue models for its hamburgers. A fast-food restaurant determines...
A fast-food restaurant determines the cost and revenue models for its hamburgers. A fast-food restaurant determines the cost and revenue models for its hamburgers. C = 0.8x + 7100,     0 ≤ x ≤ 50,000 R = 1 10,000 (66,000x − x2),     0 ≤ x ≤ 50,000 (a) Write the profit function for this situation. P =   (b) Determine the intervals on which the profit function is increasing and decreasing. (Enter your answers using interval notation.) increasing     decreasing     (c) Determine how many hamburgers...
Velocity, a consulting firm, enters into a contract to help Burger Boy, a fast-food restaurant, design a marketing strategy to compete
Velocity, a consulting firm, enters into a contract to help Burger Boy, a fast-food restaurant, design a marketing strategy to compete with Burger King. The contract spans eight months. Burger Boy promises to pay $60,000 at the beginning of each month. At the end of the contract, Velocity either will give Burger Boy a refund of $20,000 or will be entitled to an additional $20,000 bonus, depending on whether sales at Burger Boy at yearend have increased to a target level. At the inception of...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT