CS 160, Fall 2013
Programming Assignment P3
Tax Computation

Programming due Monday, Sep. 16 at noon; late deadline Sep. 16 at 10 p.m.


A Program for Computing Taxes

This programming assignment has five objectives:
  1. to teach you to read input from the keyboard,
  2. to use Java expressions involving integers and real numbers,
  3. to use conditional (if/else) statements in Java,
  4. to print formatted output,
  5. to see if you can follow a specification exactly!

Description

The program allows the user to input some of the information that normally appears on a tax form, then it calculates a tax bill according to the formulas described below. WARNING: Be aware that the tax computation shown here is greatly simplified and should not be used for calculation of your real taxes!

Instructions

For this assignment, you must follow directions exactly. Create a P3 project in Eclipse then write a class P3 with a main method, and put all of the following code into the main method:
  1. Instantiate a single Scanner object to read console input.
  2. Print the prompt shown below and ask the user for their gross salary.
  3. The gross salary represents dollars, which can be entered with or without decimal points.
  4. Print the prompt shown below and ask the user for the number of exemptions.
  5. The number of exemptions is an integer.
  6. Print the prompt shown below and ask the user for their interest income.
  7. The interest income represents dollars, which can be entered with or without decimal points.
  8. Print the prompt shown below and ask the user for their capital gains income.
  9. The capital gains represents dollars, which can be entered with or without decimal points.
  10. Print the prompt shown below and ask the user for the amount of charitable contributions.
  11. The charitable contributions represents dollars, which can be entered with or without decimal points.
  12. Perform the calculation of federal total income, as shown in the Formula section.
  13. Perform the calculation of the federal adjusted income, as shown in the Formula section.
  14. Perform the calculation of the federal total tax, as shown in the Formula section.
  15. Perform the calculation of the state income tax, as shown in the Formula section.
  16. Print out the total income, adjusted income, total tax, and state tax.
  17. The example below shows five lines of user input, with prompts, followed by four lines of program output:
Gross Salary: 57324.50
Number of Exemptions: 2
Interest Income: 2230.12
Capital Gains: 129.73
Charitable Contributions: 1172.99
Total Income: $59684.35
Adjusted Income: $55511.36
Total Tax: $9623.18
State Tax: $2775.57

Formulas

Total Income = Gross Salary + Interest Income + Capital Gains
Adjusted Income = Total Income - (Number of Exemptions * 1500.00) - Charitable Contributions
Total Tax computation: For the example above, we compute the Total Tax in the example above as follows:

16% * (25,000.00-12,000.00) = 2080.00
23% * (45,000.00-25,000.00) = 4600.00
28% * (55,511.36-45,000.00) = 2943.18

Adding up the above we get a Total Tax of $9,623.18, that's a a chunk of change! You can see the results of our other computations in output shown above.

State Tax = Adjusted Income * 0.05

Specifications

Your program must meet the following specifications:

Grading Criteria

Submit your program to the Checkin tab on the course website, as you were shown in the recitation, and read the syllabus for the late policy (if necessary).

© 2013 CS160 Colorado State University. All Rights Reserved.