print("=======================================================================")
print(" Publix")
print("=======================================================================")
finished = False
TAX_RATE = 0.070
item_no = 0
subtotal = 0.0
tax = 0.0
total = 0.0
while (not finished):
prompt = "Enter amount for item #" + str(item_no + 1) + ": $"
price = float(input(prompt))
if (price == -1):
finished = True
else:
subtotal += price
item_no += 1
print("\tprice entered: ${:.2f}".format(price))
tax = subtotal * TAX_RATE
total = subtotal + tax
print("=======================================================================")
print("TOTAL ITEMS purchased: {:d}".format(item_no))
print("SUBTOTAL: ${:.2f}".format(subtotal))
print("TAX: ${:.2f}".format(tax))
print("TOTAL: ${:.2f}".format(total))
print("=======================================================================")
print (" Publix Receipt")
print("=======================================================================")
print(" Thank you for your business!")
# EXAMPLE OUTPUT (resize window horizontally to maximum to see output clearly)
=======================================================================
Publix
=======================================================================
Enter amount for item #1: $2
price entered: $2.00
Enter amount for item #2: $3
price entered: $3.00
Enter amount for item #3: $4
price entered: $4.00
Enter amount for item #4: $2.5
price entered: $2.50
Enter amount for item #5: $-1
=======================================================================
TOTAL ITEMS purchased: 4
SUBTOTAL: $11.50
TAX: $0.81
TOTAL: $12.30
=======================================================================
Publix Receipt
=======================================================================
Thank you for your business!