(Latest Revision: 10/05/2007)

SECOND CS 1500 SOLO PROGRAM: Estimating Federal Income Tax

Your assignment is to write a program that estimates 2007 federal income tax for single filing status.

INPUT AND OUTPUT:

The program must prompt for the taxable income. The user will input a non-negative integer taxable income.

The program must compute the estimated tax on the taxable income, using Schedule X on this web page. (There is a PDF reproduction here and a cached html version here.)

The program must then report the tax, as an integer.

Have a look at the sample script to see how it should look when you run the program. Make sure to write the program so that it inputs only the taxable income. If I decide I want to test all the programs I will want to use redirection from prepared files of input. This requires that you and I have a precise agreement on the form of the input.

TESTING AND CORRECTNESS:

Your program must conform to the rules below. We will discuss and clarify the meaning of these rules in class.
  1. The test script must show testing of a representative sample of ordinary data. It must also show coverage on and near at least two boundary data values.
  2. If I run your program and it gives an incorrect result, then you may lose a very substantial amount of the credit for this assignment. (How tolerant would you be of a tax program that gives wrong answers?)
DESIGN DETAILS:

You should use int variables in this program for the income and the tax.

Since the program will report dollars but not cents, it is permissable if the reported value of the tax is incorrect by up to one dollar more or less than the true amount.

When you compile code like this
int tax ;
if (income <= 31850) tax = 782.50 + 0.150 * (income - 7825) ;
you may see a warning from the compiler like this:
warning: converting to 'int' from 'double' 
because the code assigns a real number (double) to the integer variable tax.

Nevertheless the code above is OK. It just computes the real number corresponding to the expression, and then the decimal part is "thrown away" when the value is assigned to the variable. The value that tax gets is incorrect by no more than $0.99.

A compiler warning is not the same thing as a syntax error. It does not prevent the compiler from producing an executable version (translation) of your program.


WHAT TO TURN IN:

You will be sending me two e-mail messages. Please follow these rules: Here is the list of things that you have to turn in: Note that there are no spaces in the subject lines given. It is important that you do not insert any spaces. My e-mail address is:

john@ishi.csustan.edu



WHEN IS THIS ASSIGNMENT DUE?

Look for the due date in the class schedule. (It's at the top level of the class directory.)