Create a program that will calculate the weekly average tax withholding for a customer, given the following weekly income guidelines: Income less than $500: tax rate 10% Incomes greater than/equal to $500 and less than $1500: tax rate 15% Incomes greater than/equal to $1500 and less than $2500: tax rate 20% Incomes greater than/equal to $2500: tax rate 30% Store the income brackets and rates in a dictionary. Write a statement that prompts the user for an income and then looks up the tax rate from the dictionary and prints the income, tax rate, and tax.

Respuesta :

Answer:

#here is code in python

# create a dictionary of tax rate based on the income

tax = {499 : '10%', 1499 : '15%', 2499 : '20%', 2500 : '30%'}

#read the weekly income from user

week_income = int(input("Enter income: "))

#if weekly income is less than 500

if(week_income<500):

   print("Income is : ",week_income)

   print("Tax rate is : ",tax[499])

   print("Tax on income is : ",week_income*0.1)

# if income is greater or equal 500 and less than 1500

elif(week_income<1500):

   print("Income is : ",week_income)

   print("Tax rate is : ",tax[1499])

   print("Tax on income is : ",week_income*0.15)

# if income is greater or equal 1500 and less than 1500

elif(week_income<2500):

   print("Income is : ",week_income)

   print("Tax rate is : ",tax[2499])

   print("Tax on income is : ",week_income*0.20)

# if income is greater 2500

else:

   print("Income is : ",week_income)

   print("Tax rate is : ",tax[2500])

   print("Tax on income is : ",week_income*0.30)

Explanation:

Create a dictionary, in which tax are stored as per the weekly income.For income less than 500 tax will be 10%,for greater or equal 500 and less than 1500 tax will be 15%, for greater or equal 1500 and less than 2500 tax will be 20% and greater than 2500 tax will be 30% . Read the weekly income from user and then display the income, tax rate and tax on income according to the weekly Income.

Output:

Enter income :1200

Income is :  1200

Tax rate is :  15%

Tax on income is :  180.0