Question: the code need fix make sure not change how the softwear behaviour please run it first the fault with wont calculate correctly for example it
the code need fix
make sure not change how the softwear behaviour
please run it first
the fault with wont calculate correctly
for example it multiply first item by 1 and second item by 2 and so on, and third item by 3 and so on
if you one item each,,
second fault,
if you enter any item with incorrect spelling for any item on the list, it will print it in summery
but with the previous item price, ,
everything else fine,, so only need to fix them 2 faults.
make sure not change how the softwear behaviour
#make sure not change how the softwear behaviour, break
please save it there , and return the question let me delete it
def menu(): '''Method to display menu board ''' print(''' MENU BOARD 1- pizza Tar Mar $1.95 2- pizza Dar $2.95 3- pizza Nar $3.90 4- pizza Bar $4.80 5- pizza Mar $5.70 Delivery fees $1.50 ''')
def order(): '''Method to Calculate the order details Returns: total (float): Total amount of the order list_of_order (list) : contains the qty , pizza type,price and toppings for each item ''' total = 0 price = 0 list_of_order = [] #Continues till user enters 0 to exit while(True): #To test code try: qty , pizza = input("Enter pizza mount and type Example(2 Tar Mar) / enter 0 to exit:").split(None,1) topping = input("Enter toppings (ham/cheese/ chilli/None)") #Checks for the type #And calculates the price if pizza.lower() == "tar mar": price += int(qty)* 1.95 elif pizza.lower() == "dar": price += int(qty) * 2.95 elif pizza.lower() == "nar": price += int(qty) * 3.90 elif pizza.lower() == "bar": price += int(qty) * 4.80 elif pizza.lower() == "mar": price += int(qty) * 5.70 #Stores the item details list_of_order.append((qty,pizza,round(price,2),topping)) #Calculates the total price of order total += round(price,2) #To handle errors except: break #Returns total and list_of_order return total , list_of_order
#Main method if __name__=="__main__": print("Welcome to D & G") #Repeats till user exit by entering 1 while(True): #Displays the menu menu()
#Get user name, address and tell customer_name = input("Enter your name :") address = input("Enter your address : ") tell = input("Enter your phone number : ") #Get the order placed details order_placed = input("Order placed by (phone/online) : ")
#Get the order details price , list_of_order = order() #Get the delivery details delivery = input("Order to be delivered (Y/N) : ") #Calculate the delivery amount if (delivery.lower() == 'y'): delivery_amount = 1.50 else: delivery_amount = 0
#Calculate the total amount of the entire order if (order_placed.lower()=="online"): total = 0.80*price + delivery_amount else: total = price + delivery_amount
#Display the summary of order print(f' Summary: Customer name : {customer_name} Address : {address} Phone number : {tell} Order: ') for free in list_of_order: qty,pizza,price,toppings = free if toppings.lower()!= "none": print(f"{qty} {pizza} = ${price} + {toppings} topping") else: print(f"{qty} {pizza} = ${price} ") if (order_placed.lower()=="online"): print("Discount for online orders: 20%") if(delivery.lower() == 'y'): print("Delivery charge : $1.50") print(f"Total amount : ${total:.2f}")
#Check if user wants to exit if(int(input(" Enter 1 to exit / 0 to continue:"))==1): break
please run it,, only need fixing the calculation,
and if you enter wrong spelling for any item on the list,, it will appear on the final statment, wrong price,, please run it,
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
