Calculate the weekly average tax withholding for a customer

Assignment Help Mathematics
Reference no: EM132077149

My code needs to have the following elements: 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. Need a loop that prompts the user for an income, looks up the tax rate from the dictionary, and ***prints the income, tax rate, and tax***. The loop runs indefinitely until the user enters a loop termination sentinel. My code works correctly EXCEPT it does not print the "tax rate"(%) as required

def tax(income):

 di={0:10,1:15,2:20,3:30} 

 total_tax=0

 if(income<500):

  total_tax=di[0]*income

 elif(income<1500 and income >=500):

  total_tax=di[1]*income

 elif(income<2500 and income >=1500):

  total_tax=di[2]*income

 else:

  total_tax=di[3]*income

 return total_tax

print("Enter income to calculate tax.")

n=int(input('Enter income :'))

while(n!=-1):

 print("Calculated tax is : ","%.2f"%tax(n))

 n=int(input('Enter income :'))

print('Bye')

Reference no: EM132077149

Questions Cloud

Discuss the relationship between heart rate and exercise : Research the Herzing library for articles on the relationship between heart rate and exercise. Identify at least three reliable sources that will help you.
Research quality dimensions or standards used by various : Research quality dimensions/quality standards/quality indicators used by various health care organizations that work to improve the quality of health care.
What is marketing channels vs changes in technology : Marketing channels VS Changes in technology (online marketing), Levels of service that retailers can offer
What types of problems does one tend to solve : What is a framework and what types of problems does one tend to solve?
Calculate the weekly average tax withholding for a customer : My code needs to have the following elements: calculate the weekly average tax withholding for a customer, given the following weekly
Federal court sitting in diversity jurisdiction : The Erin Doctrine provides that a federal court sitting in diversity jurisdiction over law claim must apply state substantive common law in resolving dispute.
Choose for a website back : With so many languages from which to choose for a website's back end (among them C#, Java, JavaScript, PHP, Python, Ruby, et al.)
Creating marketing plan : External and internal environments of a company before creating a marketing plan.
Perform task with a basic access list : For telnet to the router in particular, how could you perform this task with a basic access list?

Reviews

Write a Review

Mathematics Questions & Answers

  How much more will 4 tickets cost for lower bowl

Assume season-ticket prices in the lower bowl for the Buffalo Bills will rise from $495 for a 10-game package to $770. Fans sitting in the best seats in the upper deck will pay an increase from $310 to $555. Don Manning plans to purchase 4 season ..

  Sketch the curves given by the following parametric

sketch the curves given by the following parametric equations find corresponding cartesian equations if possible.a in

  How long ago was the artifact made

A wooden artifact contains 65% of the Carbon-14 that is present in living trees. How long ago was the artifact made?(the half-life of Carbon-14 is 5730 years.)

  Find the indicated function value

Find the indicated function value - What does the vertical asymptote - What percentage of the Ippizuti fish can you remove

  How long after the rocket is launched it will hit the ground

Use the quadratic formula to find out how long after the rocket is launched it will hit the ground. Round to the nearest tenth of a second.

  What is the mean monthly mortgage paid by all homeowners

Suppose that the monthly mortgage payments of all homeowners have a normal distribution. What is the mean monthly mortgage paid by all homeowners?

  How much did jack earn per hour babysitting

Jack babysat 2 hours each night for 10 nights.she earned a total $180 babysitting.Jack wants to calculate her hourly rate.How much did jack earn per hour babysitting?

  Breach of contract

Joshua, a merchant, promises in a signed writing to Pedro, a consumer, to hold an offer to sell goods open for five months. However, Joshua sells the goods to another consumer and Pedro sues him for breach of contract. Which of the following is tr..

  How much was invested in each account

A total of $8,500 was invested in three interest earning accounts. The interest rates were 2%, 3%, and 6%. If the total simple interest for one year was $380 and the amount invested at 6% was equal to the sum of the amounts in the other two accoun..

  How much must johnny williams invest

How much must Johnny Williams invest today to have an amount equivalent to investing $2,800 at the end of every six months for the next 15 years.

  What is the determinant

If A and B are 3 × 3 matrices with det(A) = 4 and det(B) = 1. What is the determinant of C = 2AT A-1BA

  What was the original price of the convertible to te nearest

After getting a 15% discount on the price of a new chrysler sebring convertible, Helen paid $27,000. What was the original price of the convertible to te nearest dollar?

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd