Assignment
Write a program to compute income tax as follows:
First, read the user's income for the year. Then, display the following menu and ask the user to select his or her filing status:
1. Single
2. Married filing separately
3. Married filing jointly
4. Head of household
After the user makes the selection, determine the amount of the deduction.
Deduction is the amount that gets deducted from the income to arrive at the taxable income. There are 4 different deductions that can be made: 1) a standard deduction, 2) deduction for dependents, 3) deduction for out of pocket medical expenses, 4) deduction for expenses due to attending college full time.
1) For Single status, the standard deduction is $2000, for Married filing separately it's $1500, for Married filing jointly, $2500 and for Head of household, deduction is $3000.
2) Then, ask for and read the number of dependents from the user. If filing as Single, add to the deduction, $150 for each dependent, up to a maximum of 4 dependents. In other words, if number of dependents is larger than 4, treat it as 4 dependents. If Married filing separately, add $125 for each dependent up to a maximum of 4 and if married filing jointly and head of household, add $175 to the deduction for each dependent, up to a maximum of 4.
3) Then, ask if the tax payer had any uncovered medical expenses. If so, add to the deduction 10% of any uncovered (out-of-pocket) medical expenses.
4) Then, ask if the tax payer was a full time student during the year. If so, read the amount of expenses relating to college and add 10% of those expenses to the deduction.
Then, compute the taxable income by subtracting the total deductions from his or her income. Finally, compute the tax. Anyone with a taxable income of less than $10,000 pays no taxes. For the rest, the first $20,000 of the income has a tax rate of 10%, the next $30,000 gets taxed at 15%, the next $50,000 at 20%, and anything above $100,000 at 30%. Remember there are 4 tax brackets and the percentage of taxes is different for each bracket. So, if the income spans over multiple brackets (anything over $20,000), each part of the income is taxed at a different percentage.
For someone with income of $13,000, the tax is simply 10% of that or $1,300. But, for someone who made $30,000, it would be 10% of $20,000 or $2,000 plus 15% of the remaining $10,000 or $1,500, making it $3,500. For someone who had taxable income of $125,000, her first $20,000 gets taxed at 10% ($2,000), plus 15% of $30,000 ($4,500), plus 20% of $50,000 ($10,000), and the remaining $25,000 at 30% ($7,500) for a total tax amount of $24,000. For someone who made $7,999 it would be 0, but for someone who made $8,000, it's $800, and so on.
Print the amount of taxes due in currency format (2 decimal places).
The following is a sample interaction between the user and the program:
Enter total income for the year (including wages, tips, bonuses, interest, winnings, etc.): $50000
What was your filing status during the year?
1. Single
2. Married filing separately
3. Married filing jointly
4. Head of household
Enter one of the above choices: 3
Enter number of dependents (excluding yourself): 3
Did you have any uncovered medical expenses? [y/n]: y
Enter amount of out-of-pocket medical expenses (copay, deductible, patient's portion): $1000
Were you a full time student during the year? [y/n]: y
Enter amount of college expenses (excluding any financial aid received): $500
The amount of your income tax is $6023.75
Press any key to continue.
Another example:
Enter total income for the year (including wages, tips, bonuses, interest, winnings, etc.): $20000
What was your filing status during the year?
1. Single
2. Married filing separately
3. Married filing jointly
4. Head of household
Enter one of the above choices: 1
Enter number of dependents (excluding yourself): 0
Did you have any uncovered medical expenses? [y/n]: n
Were you a full time student during the year? [y/n]: n
The amount of your income tax is $1800.00.