Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Computer Engineering Expert

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')

Computer Engineering, Engineering

  • Category:- Computer Engineering
  • Reference No.:- M93059604
  • Price:- $10

Priced at Now at $10, Verified Solution

Have any Question?


Related Questions in Computer Engineering

Research the followingmy company is alibabadetermine its

Research the following my company is Alibaba Determine its mission, vision, and goals. Discuss its IT architecture. Describe its databases, data warehouse, and data mining. Discuss it network system. Discuss its security ...

You are starting a company on a tight budget you can get

You are starting a company on a tight budget. You can get DSL line to your office with a static IP address, but ISP does not offer any DNS services. At this point you do not want to set up your own DNS, so you want to fi ...

Question recall the on the spot courier service introduced

Question : Recall the On the Spot courier service introduced in Unit 1. The details of the package pickup and delivery process are described here. When Bill got an order, at first, only on his phone, he recorded when he ...

When talking about economics and the history of it for the

When talking about Economics and the history of it. For the past recessions the U.S. has had, do we look at it mostly on the loan side of the banks or what causes most recessions?

Program in cit is often times advantageous to be able to

*Program in C* It is often times advantageous to be able to transfer data between two arrays. Need a help with program (transfer.c) that add a range (by start index and end index) of numbers from array #1 to array #2 at ...

Why do the chemically similar alkali metal chlorides nacl

Why do the chemically similar alkali metal chlorides NaCl and CsCl have different structures, whereas the chemically different NaCl and MnS have the same structure?

Systems analysis project personal trainer inc owns and

Systems analysis project Personal Trainer, Inc. owns and operates fitness centers in a dozen Midwestern cities. The centers have done well, and the company is planning an international expansion by opening a new "superce ...

Assume the following information for an imaginary closed

Assume the following information for an imaginary, closed economy. GDP = $100,000; taxes = $22,000; government purchases = $25,000; national saving = $15,000. Refer to Scenario 26-1.  For this economy, investment amounts ...

1 what is the boolean expression for an and gate2 what is

1. What is the Boolean expression for an AND gate? 2. What is the Boolean expression for an OR gate? 3. What is the Boolean expression for a NOT gate?

C programmingneed help with a c program arrayrearrangec

***C PROGRAMMING*** Need help with a C program array_rearrange.c that rearranges an integer array. The array will be split into two sets of integers one by one. A new array will be created by append the first set to the ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As