In: Computer Science
In PYTHON : as basic as possible
Write a program that acts as a cash register. The program will prompt how many items they are buying. Then they will input the price of each item (these should be decimal numbers). The program will display the SUBTOTAL, TAX ADDED (13%), and the TOTAL (with tax). Make sure you include $ signs and round to two decimal places ]
Sample Output:
How many items are you buying? 3
Enter in a price: $ 4.50
Enter in a price: $ 10.00
Enter in a price: $ 9.00
SUBTOTAL: $ 23.5
TAX: $ 3.06
TOTAL: $ 26.56
CODE: Python Programming Language
#Taking how many inputs user required
item = int(input("How many iterms are you buying? "))
sub_total = 0
for i in range(1, item+1):
price = float(input("Enter in a price: $ "))
sub_total = sub_total+price # Calculating subtotal
tax = sub_total * 0.13 #Calculating tax
total = sub_total + tax # Calculating total with tax
print("SUBTOTAL: $ %.2f"%(sub_total))
print("TAX: $ %.2f"%(tax))
print("TOTAL: $ %.2f"%(total))
===========================================================================
SCREENSHOT OF THE CODE:
===========================================================================
OUTPUT:
Thank you. Please ask me if you have any doubt.