(Latest Revision: 09/24/2010)
SECOND CS 1500 SOLO PROGRAM: Estimating
Federal Income Tax
Your assignment is to write a program that estimates 2009 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 taxable income.
The program must compute the estimated tax on the taxable income, using
this version of Schedule X.
The program must then report the tax, formatted as a fixed-point decimal with
(exactly) two digits after the decimal point.
(Refer to the example on page 41 of your text, and the discussion on page 44,
which illustrates the use of a double data type to represent a number
'that has a fractional part,' and the explanation on pages 55-56 of how to
format output of values of type double.)
Have a look at
the sample script
to see how things must look when you run the program.
Make sure to
write the program so that it inputs only the taxable income.
When I test the programs of all the students in the class, I will need to use
special techniques (a script that utilizes redirection from prepared files of
input). In effect, another program will test your program, and the programs
of all your classmates. This requires that all the programs behave exactly
the same way, especially when they read input.
TESTING AND CORRECTNESS:
Your program must conform to the rules below. We will discuss and clarify
the meaning of these rules in class.
- The test script must show testing of a representative sample of ordinary
data. It must also show coverage on, and coverage near, at least two
boundary data values.
- If your program gives an incorrect result when I run it, you may lose a
very substantial amount of the credit for this assignment. (How tolerant
would you be of a program that incorrectly calculates the taxes you owe?)
Here are a couple of ideas for checking on the correctness of your numbers:
- Include the tests from the sample script
among the tests you perform on your program, and verify that the
answers your program gives are the same as the answers my program gave
(to within $1.00).
- Go to this
online tax calculator site. Go to the second form on the page, under
where it says "This next calculator lets you try it out with your own
numbers." Set the tax year for 2009 and the filing status for Single.
Then, for all your test inputs, compare the answers the calculator gives
with the answers your program gives. The answers from the calculator
should be the same as the answers from your program, except rounded to
the nearest dollar.
DESIGN DETAILS:
Use double variables in this program for the income and the
tax.
WHAT TO TURN IN:
You will be sending me two e-mail messages. Please follow these rules:
- Always send me e-mail as plain text in the main message body.
Never send me attachments.
- Always use the exact subject line I specify for each
message. (I often get hundreds of e-mail messages in a week. The
subject line allows me to find and sort messages.) You will lose a
significant number of points on the assignment if you use the wrong
subject line.
- Be very careful when you send the e-mail. You may use the
instructions in your
Hello World! lab excercise
for guidance. Of course, you will need to make the obvious changes to
those directions -- you have to use the correct subject line and
filename.
- Always send yourself a copy of each e-mail message you send to me,
check immediately to see if you receive the message intact, and
check within a few minutes to see if you have received e-mail notifiying
you about an undeliverable message. You are
responsible for sending e-mail correctly.
Here is the list of things that you have to turn in:
- At the start of class on the
due date
place the following item on the "counter" in front of me:
- a hardcopy (printed listing) of your program (the C++ source code).
Make sure all the code is properly formatted and that it all shows
on the paper. (You can't put more than about 75 characters on any
line - including blanks.) If the printer paper has
perforated edges
with holes for the "printer tractor," take those off before turning
in the hardcopy.
- Before midnight on the due date
send me the following by e-mail:
- A copy of the source code (C++ code) with subject line:
CS1500Solo2Source
and
- your (filtered) script, with subject line
CS1500Solo2Script
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.)