110k views
1 vote
A retail company must file a monthly sales tax report listing the total sales for the month, as well as the amount of state and county sales tax collected. The state sales tax rate is 5 percent and the county sales tax rate is 2.5 percent. Write a Python program that asks the user to enter the total sales for the month. From this figure, your Python program should calculate and display the following:

The amount of county sales tax
The amount of state sales tax
The total sales tax (county plus state)
Use functions to calculate both the county and state sales tax amounts.

User Tumata
by
7.4k points

1 Answer

5 votes

Here is the solution to your Python problem, which needs you to include the terms '150 words':The solution to the question is mentioned below:```pythondef main(): sales_month = float(input("Enter Total Sales for the Month: ")) county_tax = calc_county_tax(sales_month) state_tax = calc_state_tax(sales_month) total_sales_tax = county_tax + state_tax print("Amount of County Sales Tax: $", format(county_tax, ".2f"), sep="") print("Amount of State Sales Tax: $", format(state_tax, ".2f"), sep="") print("Total Sales Tax: $", format(total_sales_tax, ".2f"), sep="")def calc_county_tax(amount): COUNTY_TAX_RATE = 0.025 county_tax = amount * COUNTY_TAX_RATE return county_taxdef calc_state_tax(amount): STATE_TAX_RATE = 0.05 state_tax = amount * STATE_TAX_RATE return state_taxmain()```The above-mentioned Python code is based on the given question and it does the following:Take an input from the user for the total sales in the month.Now, we have to calculate the County tax and State tax. Here are two functions named 'calc_county_tax(amount)' and 'calc_state_tax(amount)' that are used to calculate the county tax and state tax.Then, it adds the county and state tax to calculate the total sales tax for the month.Then, it displays all the above-mentioned details which are calculated on the console.

User Sergei
by
8.1k points

No related questions found