Taxes

Due Time/Date: Wednesday November 17th, 2004 12:00 midnight uhunix time.
What to do Create a JAVA program that will be called Taxes.java Failure to name the program and methods as requested will result in a 10 point deduction per mistake. 

How to 

turn in 

your homework?

  • Send e-mail to ics111-homework@hawaii.edu.  The subject of the e-mail should be "Taxes/lastname" Don't include the quotes. Lastname should be substituted for your own lastname. The subject of the e-mail should be exactly as shown or you will get points deducted.

  • The name of the class should be Taxes.java Attach your JAVA code to your e-mail.
  • Please make sure that your program runs properly in UNIX.

  • Make sure to follow the java coding standard and to add Javadoc style comments.

This assignment requires you to read the taxpayer information and given this and a tax table you will calculate the taxes that this person needs to pay.
Please keep in mind that this is a hypothetical situation. We are trying to make this simple.

Taxes.java technical details:

When your program begins it will display the following menu:

TAXES
1. Process tax information from a file
2. Process one client's tax information
3. Print tax tables in use
0. Exit

The menu options should loop until the user chooses to exit (option 0). Each menu option should be taken care of in a separate method. The development of extra methods is encouraged. Be smart, plan ahead by pseudocoding and recycle your code by using more short and task-oriented methods.
method: fileProcessing( ) must be boolean and it will process tax information from a file. If the input file is not found you should return false. If all goes well you will return true. This method will take no parameters. All the file processing should either be done in this method or in other methods that you may want to create.
method: clientProcessing( ) this is a void method. It will process one client's tax information. If there are any errors in the information entered by the user they should be dealt with inside the method itself. You should read from the keyboard and process the information inside the method itself. This method will not return anything. The results of the client tax process should be printed in this method as well.
method: printTable( ) this is a void method. It is just a bundle of println statements that will display the tables used to calculate tax payments/refunds.

Option 1 - Process tax information from a file

Format of Input file entries are as follows:
NAME : INCOME : DEPENDANTS
There should be one taxpayer per line.
Each field should be separated from the others by colon (:).


  1. Read the input file name containing taxpayers information
  2. Write an output file name to store the processed information
  3. Process all the information in the file calculating taxes for each one of the persons in it. The results of this process should be displayed in the screen and stored in the output file as well.
    The information in the file should undergo validation just as the one described below when reading information from one taxpayer only.

Option 2 - Process one client's tax information

  1. Read the taxpayer information
    • Name (string) at least 3 characters long
    • income (double) should be positive or 0. Do not accept negative income.
    • dependants (int) should be positive or 0. Do not accept a negative number of dependants.
  2. Process the taxpayer information to calculate taxes owed (or refunds) by following the given tables.
  3. Display the information in the screen (only). Follow the format below

Option 3 - Print tax tables in use
You will display the following information (obviously not in table format but in plain text). Format this information and print it to the screen. Hint: a bunch of System.out.println statements will do the trick

Taxes will be calculated as follows:
income

formula

less than $10,000 a fixed $50 tax
$10,000 <= income <=$40,000 tax will be 23% of the income
$40,000<income<=$99,000 tax will be 30% of the income
$99,000<income<=$500,000 tax will be 35% of the income
over $500,000 tax will be 39% of the income

Dependant credit
dependants

credit

0 no credit
1 - 4 $40 per dependant
5 - 6 $45 per dependant
more than 6 $50 per dependant

Rules for the input and output files:

Format of Input file entries are as follows:
NAME : INCOME : DEPENDANTS
There should be one taxpayer per line.
Each field should be separated from the others by colon (:).

Format of Output file entries are as follows:
NAME : INCOME : DEPENDANTS : TAX-TO-PAY
There should be one taxpayer per line.
Each field should be separated from the others by colon (:).

The screen output should look as follows:


	Name: Taxpayers Name
	Income: $99,999
	Dependants: 9
	Tax to pay: $99,999 (refund/payment due)
Notice that "9" is used to symbolize number.
Taxpayers name to be substituted by the one entered by the user
Tax to pay should be refund OR payment due depending on the calculations made
To calculate tax refund/payment just follow the tables. Hint: a bunch of "if" statements will do the trick.


If you have any more questions please e-mail blanca@hawaii.edu or Matt

Back to homework page