95.5k views
0 votes
Write a program that will askthe user to enter the amount of a purchase. The program should thencompute the state and county sales tax. Assume the state sales tax is4 percent and the county sales tax is 2 percent. The program should displaythe amount of the purchase, the state tax, the county sales tax, the total salestax, and the total of the sale. (which is the sum of theamount of purchase plus the total sales tax). Hint: Use the value 0.02 torepresent 2 percent, and 0.04 to represent 4 percent.

1 Answer

1 vote

Info:

I am doing it in Python. Hope it will help you.

Code:

am = float(input('Enter the amount: '))

stx = (am*0.04)

slt= (am*0.02)

tl = stx+slt+stx

print(f'Sales Tax: {slt}, State Tax: {stx}, Grand Total: {tl}')

Result:

Enter the amount: 15

Sales Tax: 0.3, State Tax: 0.6, Grand Total: 1.5

User MMakati
by
4.2k points