Write a program that will ask the user to enter the amount of a purchase. The program should then compute the state and county sales tax. Assume the state sales tax is 5 percent and the county sales tax is 2.5 percent. The program should display the amount of the purchase, the state sales tax, the county sales tax, the total sales tax, and the total of the sale (which is the sum of the amount of purchase plus the total sales tax). Hint: Use the value 0.025 to represent 2.5 percent, and 0.05 to represent 5 percent. Miles-per-Gallon

Respuesta :

Answer:

purchase_amount = float(input("Enter the amount of a purchase: "))

state_sales_tax = purchase_amount * 0.05

country_sales_tax = purchase_amount * 0.025

print("The amount of the purchase is " + str(purchase_amount))

print("The state sales tax is " + str(state_sales_tax))

print("The county sales tax is " + str(country_sales_tax))

print("The total sales tax is " + str(state_sales_tax + country_sales_tax))

print("The total of the sale is " + str(purchase_amount + state_sales_tax + country_sales_tax))

Explanation:

*The code is in Python.

Ask the user to enter purchase amount

Calculate the state sales tax, multiply purchase amount by 0.05

Calculate the county sales tax, multiply purchase amount by 0.025

Calculate the total sales tax, sum the state sales tax and county sales tax

Print the amount of the purchase, state sales tax, county sales tax, total sales tax and  total of the sale

The program is a sequential program, and does not require loops or branching.

The program in Python, where comments are used to explain each line is as follows:

#This gets input for the purchase amount

amount = float(input("Amount: "))

#This calculates the state sales tax

stateTax = amount * 0.05

#This calculates the county sales tax

countyTax = amount * 0.025

#This prints the purchase amount

print("Purchase Amount:" ,amount)

#This prints the state sales tax

print("State Sales Tax:",stateTax)

#This prints the county sales tax

print("County Sales Tax:",countyTax)

#This calculates the total tax

totalTax = stateTax + countyTax

#This prints the total sales tax

print("Total sales tax:",totalTax)

#This calculates the total sales

totalSales =amount + totalTax

#This prints the total sales

print("Total sales:",totalSales)

Read more about sequential programs at:

https://brainly.com/question/23275071