COSC 117

Project 1

Brief Description

 

Your boss wants you to write a program to calculate federal taxes on a list containing various incomes.  The program will read the values from the keyboard with -1 as sentinel data to end the list.  The program will calculate the appropriate tax for each amount and keep a running total of all taxes.  It will display the tax for each income level and at the end (when a negative value is given) it will display the sum total of all the taxes generated from the list.

 

The following is a list of tax brackets to be used:

 

$   0.00   to $ 15,000              10% federal tax

$ 15,001 to $ 60,000              15 % federal tax

Over $60,000                         33% federal tax[1]

 

But there is a catch.  A person in the 15,001 to 60,000 bracket pays only 10% on the first 15,000 and 15% on the remaining income.  A person in the over 60000 bracket pays only 10% on the first 15,000 and 15% on the next 45,000 (the amount in the second bracket) and 33% on the remaining income. 

 

Sample Input/Output

Sample I/O 1

Please input the income, type a negative number to end

12000

The tax on $12000.00 is $1200.00                                                           (first bracket so .10 * 12000)

Please input the income, type a negative number to end

128760                                                                                          (third bracket so 1500 (largest tax on 1st bracket) + 6750

The tax on $128760.00 is $30940.80                                           ( largest tax on 2nd bracket            ) + amount

Please input the income, type -1 to end( over 60000 * .33)

-1

The total tax is $32140.80

Sample I/O 2

Please input the income, type a negative number to end

14500

The tax on $14500.00 is $1450.00

Please input the income, type a negative number to end

56700

The tax on $56700.00 is $7755.00

Please input the income, type a negative number to end

256090

The tax on $256090.00 is $72959.70

Please input the income, type a negative number to end

-1

The total tax is $82164.70

 

This project will consist of 2 parts:

 

1)      An algorithm in Java which identifies the variables, a tree structure and pseudo code

2)     The Java code

 

Extra Credit:

Do the Java for six tax brackets as given in footnote 1.         5 extra points

Use only constants (no literal values) in Java code               5 extra points

 

 

Part 1  Algorithm  Must be typed (except for the tree structure) and placed in a folder with your name on the outside of the folder.

 

The algorithm must consist of the following items:

 

1)     Description of the problem  This is given to you but you must be include in your packet

 

2)     Sample Input/Output  You will always be given at least one sample I/O run.  You should include at least 2 of your own.

 

3)     List all the variables and constants you will use.

 

The variables should be broken down into   input variables (data needed by the program)

                                                                       output variables (processed data displayed)

                                                                        other variables used in processing

4)      Prepare an algorithm  (tree structure or pseudo code)

 

 

Part 2  The Program--- The program section must have the code printed and placed in the folder and the digital copy of the program (the .java source code) mailed to dxdefino@salisbury.edu.

The Class name must be called TaxIncome.  When setting up your project and adding the class to the project be sure to call the class TaxIncome.  

 

 

 

Part 1 Due Date:     Monday       September 28

Part 2 Due Date:     Monday       October 5

 



[1] There are actually six tax brackets but we use only three here to make the problem less cumbersome.

0-           15,000     10%                           60,001 -120,000  25%                          180,001  326,000    33%

15,001- 60,000     15%                         121,000-180,000  28%                           326,001  above        35%