John D.

asked • 04/24/21

How Can I Add a Receipt?

Hello I'm working on an assignment and I want to figure out how I would be able to save which items the user chooses and how many times he chooses that item so I can form a receipt. This is what I have so far. Any help would be amazing!

|

|

V



#Here we have a welcome message along with directions on how to access the menu! We also have a goodbye message for future use

print("Welcome to big Johnny's Cafe!")

print("We have a wide selection of drinks and food to choose from!")

x = input("If you want to see our Menu type out 'menu': ")

tym = "Thank you for coming to Big Johnny's Cafe! We hope we see you again!"


#Here is me setting up the value of each item in the menu

Blueberry_Muffin = 1.25

Chocolate_Muffin = 1.50

Chocolate_Chip_Cookie = 0.50

Rainbow_Sprinkle_Cookie = 0.50

Coffee = 3.50

Croissant = 1.00


#I put that total is equal to zero so I'm able to add onto the total later on without it resetting or whatever

total = 0.0


#The reason I put this here is because I plan on using a while loop that will continue until the user is finished ordering!

finished = False


#This is to recognize that the user input was menu and this displays the menu

if x == "menu":

print(" ")

print("Our Menu Includes:")

print(" ")

print("1 Blueberry Muffin $"+str(Blueberry_Muffin))

print("2 Chocolate Muffin $"+str(Chocolate_Muffin))

print("3 Chocolate Chip Cookie $"+str(Chocolate_Chip_Cookie))

print("4 Rainbow Sprinkle Cookie $"+str(Rainbow_Sprinkle_Cookie))

print("5 Coffee(Standard Medium) $"+str(Coffee))

print("6 Croissant $"+str(Croissant))

print(" ")

#The reason I put this here is because I plan on using a while loop that will continue until the user is finished ordering!

finished = False


#Here is a while loop that is used to let the customer decide how much stuff they want until they are finished

while(not finished):

print("Total:", total);

choice = input("Select a number or type 'finished' when you have finished ordering: ");

if choice == "1":

total += Blueberry_Muffin;

elif choice == "2":

total += Chocolate_Muffin;

elif choice == "3":

total += Chocolate_Chip_Cookie;

elif choice == "4":

total += Rainbow_Sprinkle_Cookie;

elif choice == "5":

total += Coffee;

elif choice == "6":

total += Croissant;

elif choice == "finished":

print("Subtotal: $"+ str(total));

tend = total*.1

print("10% off -"+str(tend))

print("Subtotal: $"+ str(total-tend))

fifd = total*.15

print("15% off -"+str(fifd))

print("Subtotal: $"+ str(total-fifd))

tax = total*.06625

print("Tax +"+str(tax))

print(" Total: $"+ str(total+tax))

finished = True




1 Expert Answer

By:

Patrick B. answered • 04/24/21

Tutor
4.7 (31)

Math and computer tutor/teacher

John D.

Thanks for the suggestion!
Report

04/24/21

Still looking for help? Get the right answer, fast.

Ask a question for free

Get a free answer to a quick problem.
Most questions answered within 4 hours.

OR

Find an Online Tutor Now

Choose an expert and meet online. No packages or subscriptions, pay only for the time you need.