For this homework you will implement a program that calculates the federal taxes that a single person in the US must pay given her gross income. This homework is due **Tuesday September 15 @noon**. Like many countries, the US uses tax brackets to calculate the taxes a person must pay. The steps to calculate the tax amount are the following: (also see the wikipedia explanation)

- Start with the gross income, subtract $5,700 from it. This is the new income value.
- Use the table below and apply the various marginal tax rates depending on the person's new income value:
Income Marginal Tax Rate <= $8350 10% $8,351– $33,950 15% $33,951 – $82,250 25% $82,251 – $171,550 28% $171,551 – $372,950 33% $372,951+ 35%

For example, if the income is $20,000, then we first subtract $5700 to get $14,300. Of this we have to pay 10% for the first $8,350, which works out to be $835, plus 15% of ($14,300 - $8,350) which is $892. So the total tax is $835 + $892 = $1,727.

So, your program will ask the user to enter the income and then print out the tax, as such:

Please enter income: 20000 Your taxes are $1727.

Please think carefully about this program before you start coding it. Remember, the homework is due **Tuesday September 15 @noon**. Please email it to your TA when you are done.

## 2 comments:

should we typecast doubles as integers? Because (14,300 - 8,350)*.15 is 892.5, should we ignore the 50 cents?

Also, because 10% of 8350 is 835, shouldn't it be $835 + $892 = $1727? not 825 + $892 = $1,717? or maybe I'm just missing something?

Yes, ignore cents, the IRS does. And, its OK to use integers. I assume anyone making more than 1.2billion will have her own accountant.

I've fixed the $825 typo.

Post a Comment