200k views
4 votes
write an algorithm that gets two values: the price for item A and the quantity purchased. The algorithm should then print the total cost and the total cost plus an 8% sales tax.

1 Answer

3 votes

Answer:

Step-by-step explanation:

price = eval(input("price of item: "))

quantity = eval(input("quantity of item: "))

sales_tax = 0.08 # 8% sales tax

total_cost = price*quantity

total_cost_with_tax = total_cost + total_cost*sales_tax

print("total cost: "+str(total_cost))

print("total cost + 8% sales tax: "+str(total_cost_with_tax))

write an algorithm that gets two values: the price for item A and the quantity purchased-example-1
User Elisabete
by
5.7k points