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 4 percent and the county sales tax is 2 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.02 to represent 2 percent, and 0.04 to represent 4 percent.

right

To write a program that calculates sales tax, you can use the following steps:

1. Ask the user to enter the amount of the purchase. You can use the input() function to get user input and convert it to a float value.

2. Calculate the state sales tax by multiplying the amount of the purchase by 0.04 (4 percent). Save this value in a variable.

3. Calculate the county sales tax by multiplying the amount of the purchase by 0.02 (2 percent). Save this value in a variable.

4. Calculate the total sales tax by adding the state sales tax and the county sales tax. Save this value in a variable.

5. Calculate the total of the sale by adding the amount of the purchase and the total sales tax. Save this value in a variable.

6. Display the amount of the purchase, the state sales tax, the county sales tax, the total sales tax, and the total of the sale to the user. You can use the print() function to display the values.

Here is an example solution in Python:

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

state_sales_tax = purchase_amount * 0.04
county_sales_tax = purchase_amount * 0.02
total_sales_tax = state_sales_tax + county_sales_tax
total_sale = purchase_amount + total_sales_tax

print("Amount of the purchase: $", purchase_amount)
print("State sales tax: $", state_sales_tax)
print("County sales tax: $", county_sales_tax)
print("Total sales tax: $", total_sales_tax)
print("Total of the sale: $", total_sale)
```

When you run this program and enter the amount of the purchase, it will calculate the sales tax and display the results as specified in the question.