COMP 11 - Introduction to Computer Science - Fall 2002

# Programming projects due week of Mon 9/23 (wk. 4): pp2

Due dates: Section 01 (Block H): Wed 9/25 11:00 pm; Section 02 (Block E): Thu 9/26 11:00 pm;

Submissions may begin on Mon 9/23 at 5pm.

Project pp2: 4 points. (1 additional style point. ) A Tool for Tax Forms

In this project you will implement a computer program that can be used as an aid in filing (a simplified version of) IRS tax forms. You task is to prompt the user for whatever information is needed from them and report the results of intermediate calculations as well as the final tax.

The user will need to supply the following information:

• Name: Prompt for a string value from the user (you may assume a single word - no spaces).
• Filing Status: Prompt for a character value from the user: 's' for ``filing separately'' (covering single and married filing separately) and 'j' for ``filing jointly'' (covering married filing jointly).
• Dependents: Prompt for an integer value from the user, the number of dependents that are claimed.
• Total income: Prompt for a floating point value from the user.
• Itemized deductions: Prompt for a character value to ask whether the user wants to itemize deductions ('y') or not ('n').

If (and only if) the answer is yes, then you should prompt for a floating point value from the user giving the amount of itemized deductions.

The tax is calculated in several steps:

Calculate the deductions:
Basic deduction:
If using itemized deductions then you get the amount from the user. Otherwise, if filing separately use the amount \$5000 and if filing jointly use \$8000.
Exemptions:
Some people can make an additional deduction based on their income level. If filing separately, the total income must be below (or equal) \$100000, and if filing jointly \$150000. If this holds then the deduction amount is \$2900 times the number of people claimed (number of dependents plus one when filing separately or plus two if filing jointly).
Total Deductions:
is the sum of these two deductions.
The total deductions should be reported in your output.
Calculating the taxable income:
Simply the total income minus the total deductions (or zero if income is lower than deductions). This amount should be reported in your output.
Calculating the tax:
This amount should be reported in your output.
If filing separately:
If the taxable income is below \$30000, then the tax is 15% of the taxable income. Otherwise, it is \$4500 plus 30% of the amount over \$30000.
If filing jointly:
If the taxable income is below \$50000, then the tax is 15% of the taxable income. Otherwise, it is \$7500 plus 30% of the amount over \$50000.
Calculating the tax credits:
This amount should be reported in your output.

The potential tax credit is calculated by multiplying the number of dependents by \$600. If this number is larger than the tax then the tax credit is equal to the tax (so the final amount due is zero). Otherwise the tax credit is the same as the potential tax credit.

Calculating the final amount Due:
The final amount due is the tax minus the tax credit. This amount should be reported in your output.
You should prompt the user for the information in exactly the same order as described above. You should then calculate the tax and write a report as illustrated in he following examples. Note that each amount printed is preceded by a \$ sign. You must include the \$ sign before the number as our automatic grader will look for it when analyzing your output. All dollar amounts must be printed in fixed format and with two fraction digits. The following examples illustrate the requirements. The information provided by the user is given in bold.

Apollo is filing separately, has 3 dependents, earns \$105000 (so he does not get exemptions) and does not itemize deductions:

Please type one character followed by [ENTER]
Are you filing separately (s) or jointly (j)? s
Please enter the number of dependents (0 for none): 3
Please type one character followed by [ENTER]
Would you like to itemize deductions (y/n)? n

```Tax report for Apollo
Total income:     \$ 105000.00
Total deductions  \$   5000.00
Taxable income    \$ 100000.00
Calculated Tax    \$  25500.00
Tax Credit        \$   1800.00
Final amount due  \$  23700.00
```

Jupiter is filing jointly, has one dependent, earns \$85000, and itemizes deductions of \$10000:

Please type one character followed by [ENTER]
Are you filing separately (s) or jointly (j)? j
Please enter the number of dependents (0 for none): 1
Please type one character followed by [ENTER]
Would you like to itemize deductions (y/n)? y
Please enter itemized deductions amount: 10000

```Tax report for Jupiter
Total income:     \$  85000.00
Total deductions  \$  18700.00
Taxable income    \$  66300.00
Calculated Tax    \$  12390.00
Tax Credit        \$    600.00
Final amount due  \$  11790.00
```

Programming style guidelines for this week

There is one style point this week. In order to earn it you must do all the following: Make sure the program is well indented, uses variables with meaningful names and documents their purpose. Define constants and use them for all the numbers given above (which may change from one tax year to the next).

Assuming your program is in a file named taxcalc.cpp which is in the current directory on andante, you should submit by typing (or substitute your file name instead of taxcalc.cpp)
provide comp11 pp2 taxcalc.cpp