CS 230 Fall 2004

Assignment 4 –More Complicated Branching

100 points

 

Assigned: 09/28/2004

Due: 10/05/2004 at the start of class

 

Pre-Lab (Do Before Lab):  Bring a new disk. Plan out tasks, objects, and events needed for program. Plan out major pseudocode

 

Main Assignment:

It’s tax time! Write a program that calculates the amount of tax that a taxpayer should have paid. Get from the user for their net income (this is income after all deductions and exemptions etc – we’ll save that stuff for a more advanced program) and the amount of tax they have already had withheld from their paycheck. Then according to the simplified (for your benefit) tax schedule shown below, calculate the amount of tax, and the amount of refund or the amount of tax still due. 

 

Tax Schedule (We are only handling Single taxpayers)

               Income                                                              Tax Rate

               First $25,000 in net income                           15%

               Next $35,000 in net income                          27%

               Remaining Income                                          30%

 

Provide capabilities to calculate, clear the text boxes to start again, and to exit.

 

Hand in:

 

Miscellaneous:

 

If you have any questions about the tax scheme, please ask!!! Read carefully! Your calculations need to meet the requirements of the task.

 

Define income thresholds and tax rates as named constants, so that if the tax law changes they are easy to change.

 

Note that we have now covered specifying how many decimal places to display – display a number appropriate for the results, with currency symbols where appropriate.

 

We’re no longer going to assume that the clerk enters valid and reasonable values, so ensure that values entered are numbers and that they are in acceptable range. Let’s assume that income and amount withheld SHOULD NOT be negative, and that income should not be more than $1 billion and amount withheld should not be more than $100 million

 

MAKE SURE YOUR PROGRAM WORKS! (i.e. gets the correct answers). Now that our program is branching, we need to try more examples to make sure they work. Think, “what different possibilities need to be checked?” For each, calculate the correct answer by hand and see if your program gets it!

 

Put YOUR NAME, and e-mail address in comments at the beginning of the program.

 

You MUST include comments that explain your program in order to get full credit.

 

Remember to use meaningful variable names, and indent to show the structure of the program (VB usually does this correctly).

 

Try to use good user interface design.