Hello, I'm new in C++, and I would like to know, How I do this?

computeTax()

In order to determine the tax burden, it is necessary to project the monthly income to yearly income, compute the tax, and reduce that amount back to a monthly amount. In each case, it is necessary to determine the tax bracket of the individual and to then apply the appropriate formula. The tax brackets for the 2006 year are:

If taxable income is over-- But not over-- The tax is:

$0 $15,100 10% of the amount over $0

$15,100 $61,300 $1,510.00 plus 15% of the amount over 15,100

$61,300 $123,700 $8,440.00 plus 25% of the amount over 61,300

$123,700 $188,450 $24,040.00 plus 28% of the amount over 123,700

$188,450 $336,550 $42,170.00 plus 33% of the amount over 188,450

$336,550 no limit $91,043.00 plus 35% of the amount over 336,550

The pseudocode for computeTax() is the following:

computeTax (monthlyIncome)

yearlyIncome ← monthlyIncome * 12

if ($0 ≤ yearlyIncome < $15,100)

yearlyTax ← yearlyIncome * 0.10

if ($15,100 ≤ yearlyIncome < $61,300)

yearlyTax ← $1,510 + 0.15 *(yearlyIncome - $15,100)

if ($61,300 ≤ yearlyIncome < $123,700)

yearlyTax ← $8,440 + 0.25 *(yearlyIncome - $61,300)

if ($123,700 ≤ yearlyIncome < $188,450)

yearlyTax ← $24,040 + 0.28 *(yearlyIncome - $123,700)

if ($188,450 ≤ yearlyIncome < $336,550)

yearlyTax ← $42,170 + 0.33 *(yearlyIncome - $188,450)

if ($336,550 ≤ yearlyIncome)

yearlyTax ← $91,043 + 0.35 *(yearlyIncome - $336,550)

monthlyTax ← yearlyTax / 12

return monthlyTax

end

computeTax()

In order to determine the tax burden, it is necessary to project the monthly income to yearly income, compute the tax, and reduce that amount back to a monthly amount. In each case, it is necessary to determine the tax bracket of the individual and to then apply the appropriate formula. The tax brackets for the 2006 year are:

If taxable income is over-- But not over-- The tax is:

$0 $15,100 10% of the amount over $0

$15,100 $61,300 $1,510.00 plus 15% of the amount over 15,100

$61,300 $123,700 $8,440.00 plus 25% of the amount over 61,300

$123,700 $188,450 $24,040.00 plus 28% of the amount over 123,700

$188,450 $336,550 $42,170.00 plus 33% of the amount over 188,450

$336,550 no limit $91,043.00 plus 35% of the amount over 336,550

The pseudocode for computeTax() is the following:

computeTax (monthlyIncome)

yearlyIncome ← monthlyIncome * 12

if ($0 ≤ yearlyIncome < $15,100)

yearlyTax ← yearlyIncome * 0.10

if ($15,100 ≤ yearlyIncome < $61,300)

yearlyTax ← $1,510 + 0.15 *(yearlyIncome - $15,100)

if ($61,300 ≤ yearlyIncome < $123,700)

yearlyTax ← $8,440 + 0.25 *(yearlyIncome - $61,300)

if ($123,700 ≤ yearlyIncome < $188,450)

yearlyTax ← $24,040 + 0.28 *(yearlyIncome - $123,700)

if ($188,450 ≤ yearlyIncome < $336,550)

yearlyTax ← $42,170 + 0.33 *(yearlyIncome - $188,450)

if ($336,550 ≤ yearlyIncome)

yearlyTax ← $91,043 + 0.35 *(yearlyIncome - $336,550)

monthlyTax ← yearlyTax / 12

return monthlyTax

end

Topic archived. No new replies allowed.