A customer in a store is purchasing five items. Write a program that asks for the price of each item, and then displays the subtotal of the sale, the amount of sales tax, and the total. Assume the sales tax is 6 percent.
Python code:
salestax = 0.06
item1=float(input("Enter the price of first item:"))
item2=float(input("Enter the price of second item:"))
item3=float(input("Enter the price of third item:"))
item4=float(input("Enter the price of four item:"))
item5=float(input("Enter the price of five item:"))
subtotal =item1+item2+item3+item4+item5
print("The subtotal of the sale:",subtotal)
anountofsalestax = subtotal * salestax
print("The amount of sales tax:",anountofsalestax)
Total = subtotal + anountofsalestax
print("Total:",Total)
Sample output:
>>>
Enter the price of first item:20
Enter the price of second item:30
Enter the price of third item:40
Enter the price of four item:50
Enter the price of five item:60
The subtotal of the sale: 200.0
The amount of sales tax: 12.0
Total: 212.0
>>>
salestax = 0.06
item1=float(input("Enter the price of first item:"))
item2=float(input("Enter the price of second item:"))
item3=float(input("Enter the price of third item:"))
item4=float(input("Enter the price of four item:"))
item5=float(input("Enter the price of five item:"))
subtotal =item1+item2+item3+item4+item5
print("The subtotal of the sale:",subtotal)
anountofsalestax = subtotal * salestax
print("The amount of sales tax:",anountofsalestax)
Total = subtotal + anountofsalestax
print("Total:",Total)
Post the discussion to improve the above solution.