Question: I am creating a python tkinter program to calculate order total for meal purchase. It will not display the sub total, sales tax, and order

I am creating a python tkinter program to calculate order total for meal purchase. It will not display the sub total, sales tax, and order total. Can you show my how to calculate the pricess correctly?
Parts of code:
def receipt():
sub_total, sales_tax, order_total = calculate_total()
# else statement to display a receipt message box if all input is valid
receipt_message =(f"Thank you for your order! Elli-May will see you soon!
"
f"
Name: {first_name_entry.get()}{first_name_entry.get()}"
f"
Phone Number: {phone_number_entry.get()}"
f"
Sandwich: {sandwich_selected.get()}"
f"
Taco: {taco_selected.get()}"
f"
Taco Toppings: {none_selected.get()}{pico_selected.get()}{cheddar_cheese.get()}"
f"{sour_cream.get()}{pickled_onions.get()}{jack_cheese.get()}"
f"
Combo: {combo_selected.get()}"
f"
Side: {side_selected.get()}"
f"
Drink: {drink_selected.get()}
"
f"
Sub Total: ${sub_total:.2f}"
f"
Tax: ${sales_tax:.2f}"
f"
Total: ${order_total:.2f}")
messagebox.showinfo("Receipt", receipt_message)
def calculate_total():
""" calculate_total function to calculate total price of order """
# declaring variables for meal calculations
sub_total = float(0.00)
sales_tax = float(0.07)
if sandwich_selected.get()!= sandwich_options[0]:
sub_total += sandwich_prices
if taco_selected.get()!= taco_options[0]:
sub_total += taco_prices
if combo_selected == "yes":
sub_total += add_combo
elif combo_selected =="no":
sub_total += no_combo
if side_selected.get()!= side_options[0] and combo_selected.get()!= "Yes":
sub_total += side_prices
if drink_selected.get()!= drink_options[0] and combo_selected.get()!= "Yes":
sub_total += add_drink
tax_total = sub_total + sales_tax
order_total = sub_total + tax_total
return sub_total, tax_total, order_total
sandwich_options =["No Sandwich", "BBQ Pulled Pork", "Slaw-py Sliders", "BBQ Beef Brisket", "Pork Wrangler", "BBQ Pork Sliders", "The Ringer", "Best of Both Worlds","Smoked Chicken", "BBQ Beef Brisket Sliders", "Chicken Sliders","Slaw=py Pork"]
# creating parallel list for sandwich prices
sandwich_prices =["0.00","8.00","10.00","10.00","9.50","9.00","11.50","9.00","9.00","11.00","9.00","9.50"]
# declaring variable for sandwich_options list
sandwich_selected = StringVar()
# setting default value of list
sandwich_selected.set(sandwich_options[0])
taco_options =["No Tacos","BBQ Brisket Tacos","Pork Tacos","Chicken Tacos"]
# creating a parallel list for taco prices
taco_prices =["0.00","11.00","9.00","9.00"]
# declaring variable for taco_options list
taco_selected = StringVar()
# setting default value of list
taco_selected.set(taco_options[0])
topping_options =["None","Pico","Cheddar Cheese","Sour Cream","Pickled Red Onions","Jack Cheese"] # toppings are not charged an additional fee they are created with checkbuttons
# combo option created with checkbutton
if combo_selected == "Yes":
add_combo =2.00
else:
no_combo =0.00
# if combo is selected 2.00 is added to taco or sandwich price and there is no charge for side and drink
side_options =["No Side","Cole Slaw","Fries","Tator Tots","Potato Salad","Onion Rings"]
side_prices =["0.00","3.00","3.00","4.00","3.50","4.00"]
# declaring variable for side_options list
side_selected = StringVar()
# setting default value of list
side_selected.set(side_options[0])
drink_options =["No Drink","Water","Pepsi","Diet Pepsi","Sierra Mist","Mountain Dew","Diet Mountain Dew","Root Beer"]
# declaring variable for drink_options list
drink_selected = StringVar()
# setting default value of list
drink_selected.set(drink_options[0])
# declaring price of adding a drink:
add_drink =2.00

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!