MAKE FLOWCHART TO GO ALONG WITH IT FLOWCHART EXAMPLE PROVIDED AS WELL AS MY CODE
PYTHON PROGRAMMING ONLY
NEED HELP MAKING A FLOWCHART TO GO ALONG WITH MY CODE
MY CODE IS ALREADY DONE AND CORRECT JUST NEED TO MAKE FLOWCHART TO GO ALONG WITH IT
FLOWCHART EXAMPLE PROVIDED AS WELL AS MY CODE
QUESTION:
A retail company must file a monthly sales tax report listing the total sales for the month,
and 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 program that asks the user to enter
the total sales for the month. From this figure, the application 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)
MY CODE:
# Function to validate input as a positive float
def get_valid_float(prompt):
while True:
try:
value = float(input(prompt))
if value >= 0:
return value
else:
print("Please enter a positive value.")
except ValueError:
print("Invalid input. Please enter a valid number.")
# Constants for tax rates
STATE_TAX_RATE = 0.05
COUNTY_TAX_RATE = 0.025
# Get the total sales from the user
total_sales = get_valid_float("Enter the total sales for the month: $")
# Calculate the county and state sales tax
county_sales_tax = total_sales * COUNTY_TAX_RATE
state_sales_tax = total_sales * STATE_TAX_RATE
# Calculate the total sales tax
total_sales_tax = county_sales_tax + state_sales_tax
# Display the results
print(f"County Sales Tax: ${county_sales_tax:.2f}")
print(f"State Sales Tax: ${state_sales_tax:.2f}")
print(f"Total Sales Tax: ${total_sales_tax:.2f}")
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 1 images