CIS3931 Intro to JAVA Programming

Assignment #2 – Federal Withholding Tax Calculator

 

Overview

 

Create a JAVA program that will calculate Federal Withholding taxes based on the IRS document found at http://www.irs.gov/pub/irs-pdf/p15t.pdf . Please note : there is no need to read this entire 64 page document! I will tell you the few pages you need from it.

 

 

 

Details

 

For this assignment, you will be writing a program that will calculate per-paycheck Federal Withholding taxes.

 

You can make the following assumptions :

·      Paychecks are either bi-weekly or weekly only

·      All users are filing as “single”

 

Your program should be bound by the following constraints

·      Paychecks are to be entered in whole dollar amounts ($600, not $600.43), but withholding taxes should be displayed with decimal numbers.

·      The program should only accept paycheck amounts between $100 and $2500 (inclusive)

·      Acceptable withholding allowances are 0 through 10 (inclusive)

 

Remember : All user inputs should be checked to make sure they meet the constraints!

 

 

You will use the following pages from the IRS document :

·      Page 2 – Table 1 – Table of amounts to use per withholding allowance

·      Page 2 – The table below table 1 – Used to see how to perform the calculations

·      Page 3 – Table 1a and 2a – Amounts to withheld based on taxable dollar amount

 

 

Program Flow

 

·      The program should first query the user for his or her total wage payment. This is the gross paycheck amount before taxes. Remember, you need to check this value to make sure it is between $100 and $2500 (inclusive). If the inputted value falls outside of this range, you must ask the user to re-input a value. You will continue to ask the user to input a value until an acceptable value is entered.

·      The program should then ask the user to input his or her total tax allowances. Remember, this value must be between 0 and 10 (inclusive). As with the total wage payment, you should continue to ask the user to input this value until an acceptable one is entered.

·      You should now as the user to input whether or not the paycheck is a bi-weekly or a weekly amount. This can be done several ways – I’ll leave it up to you to figure out which is easiest.

·      You should now take the number of allowances and multiply it by the corresponding value from Table 1. We will call this the “total allowance.”

·      You should now check to make sure that the total allowance is not greater than the total wage payment. If it is, then the total withholding amount should be zero. At this point, you would need to make no further calculations and report to the user that their Federal Tax withholding amount is $0 per paycheck.

·      If the total allowance is less than the total wage payment, then you should subtract the total allowance from the wage payment and store this calculated value. We will call this the “taxable amount.”

·      You should now devise a method by which to calculate the withholding amount based on the taxable amount you just found and the data in the tables on page 3.

·      Report the withholding amount to the user and end the program.

 

 

Example outputs

 

Example run 1 :

Please enter your total wage payment ($100-$2500) : 500

Please enter your withholding allowances (0-10) : 2

Is your paycheck weekly or bi-weekly ?

Enter 1 for weekly, 2 for bi-weekly : 1

Your total federal withholding amount is : 42.663999999999994

 

Example run 2 :

Please enter your total wage payment ($100-$2500) : 2345

Please enter your withholding allowances (0-10) : 5

Is your paycheck weekly or bi-weekly ?

Enter 1 for weekly, 2 for bi-weekly : 2

Your total federal withholding amount is : 289.86249999999995

 

Example run 3 :

Please enter your total wage payment ($100-$2500) : 400

Please enter your withholding allowances (0-10) : 11

The value you entered is out of range.

Allowances must be between 0 and 10 inclusive.

Please enter your withholding allowances : 9

Is your paycheck weekly or bi-weekly ?

Enter 1 for weekly, 2 for bi-weekly : 1

You are not subject to any federal withholding.

 

Grading

 

5 points – Name, date, and assignment number on top of program

20 points – Proper commenting

25 Points – Programming style

20 Points – Proper user input checking

30 Points – Program produces correct values on test cases

 

Total : 100 points

 

 

Extra Credit Opportunities

 

+5 points – Round all decimal numbers to two decimal places.

 

+10 points – Checking to make sure users enter a whole dollar amount in the total wage payment. This means that you must allow the user to enter decimal values without crashing the program.

 

+10 points – Incorporate a method (function) other than the main function in your program. This method must have multiple lines  (it can not be a single println statement).

 

 

Grading explanation

 

Name, date, assignment number

   Your program should have the following header format

   /*

   Name : {YOUR NAME HERE}

   Date : {PROGRAM SUBMISSION DATE}

   Assignment : {ASSIGNMENT NUMBER AND TITLE}

   */

 

Proper commenting

   Your program should be properly commented. This means that a person who is unfamiliar with the JAVA programming language should be able to understand what each line/section of your code is doing by simply reading your comments. There is no such this as too much commenting, so feel free to comment as much as you want.

 

Programming style

   This is a catch all for many things. Your program should be indented correctly. The code should be easy for the grader to read. You should optimize your code so that you are meeting the objectives in as little lines of code as possible. You should attempt to use the most advanced programming technique possible to complete the objective. For example, use loops instead of manually repeated the same block of code. Your variable names should be clear and concise.

 

Proper user input checking

   Self explanatory.

 

Program produces correct values on test cases

   Be sure to check your program to be sure it works on all imaginable cases. Just because it works for a few numbers doesn’t mean it will work for everything. We will be testing your program will a set of numbers that are designed to test every aspect of the programming objective. Please note : we are not expecting you to check for rounding errors. All values will be given a window of + or - 1 cent.

 

 

 

Program due date and submission instructions

 

This program is due no later than Thursday, the 26th of May 2005 at 11:59:59pm.

Program due date has been extended to Tuesday, the 31st of May 2005 at 11:59:59pm 

 

The program should be named Assignment2YOURFULLNAME.java

(Example : Assignment2RobertThornton.java)

 

You are to submit your source code (your .java file) to cis3931 at cs dot fsu dot edu

 

For assignment clarifications, please e-mail thornton at psy dot fsu dot edu

 

For help with your program, please e-mail cis3931 at cs dot fsu dot edu