Ask Question
3 March, 13:10

Create a simple self-checkout system. Prompt for the prices and quantities of three items. Calculate the subtotal of the items. Then calculate the tax using a tax rate of 6.5%. Print out the line items with the quantity and total, and then print out the subtotal, tax amount, and total.

+5
Answers (1)
  1. 3 March, 13:28
    0
    subtotal = 0

    total = 0

    tax_rate = 6.5

    for i in range (1,4):

    price = float (input ("Enter the price for item " + str (i) + ": "))

    quantity = int (input ("Enter the quantity for item " + str (i) + ": "))

    subtotal + = (price * quantity)

    tax = subtotal * tax_rate/100

    total = tax + subtotal

    print ("Subtotal: " + str (subtotal) + ", Tax: " + str (tax) + ", Total: " + str (total))

    Explanation:

    - Initialize the variables

    - Create for loop that iterates 3 times

    - Ask the user for the price and quantity of each item

    - Calculate the subtotal with given inputs

    - When the loop is done, calculate the tax and total

    - Print the subtotal, tax, and total
Know the Answer?
Not Sure About the Answer?
Get an answer to your question ✅ “Create a simple self-checkout system. Prompt for the prices and quantities of three items. Calculate the subtotal of the items. Then ...” in 📙 Computers & Technology if there is no answer or all answers are wrong, use a search bar and try to find the answer among similar questions.
Search for Other Answers