COMP 11 - Introduction to Computer Science - Fall 2002

Project pp4

Programming project due week of Mon 10/7 (wk. 6)

Due dates:
Section 01 (Block H): Wed 10/9 11:00 pm
Section 02 (Block E): Thu 10/10 11:00 pm
Submissions may begin on Mon 10/7 at 5pm.


Project pp4: 6 points. (1 additional style point. ) A Tax Advisor


In this project you will continue your work from pp2 and implement a system that can help people decide what is the best way for them to file their taxes. In particular you will help couples decide whether they should file separately or jointly and whether they should itemize deductions or not. You task is to prompt the user for whatever information is needed from them, make the tax calculations for each option available and report the details for the best option as well as a comparison to other options.

The Tax Rules

The tax rules remain the same as in pp2, except for a vary minor change. In an effort to encourage people to submit jointly the IRS increased the basic deduction amount when filing jointly to $15000 (it was $8000).

It is important to notice that you can reuse your code from pp2 for this project. The basic idea is to use part of the pp2 code in a function that takes all the relevant information (filing separately or jointly, income, etc) as arguments and returns the final amount due. This function can be used several times for the several variations we list so that the main function can choose the best option.

What is the best way to file?

Given the tax rules a couple has to decide whether to file jointly or separately and whether to claim itemized deductions or not. This gives the following 5 options: (1) file jointly and itemize deductions, (2) file jointly and not itemize deductions, (3) file separately and first person itemizes deductions, (4) file separately and second person itemizes deductions, (5) file separately and not itemize deductions. Note that we are assuming that there is a sum that the couple can claim and that if filing separately it is better to claim the whole sum on one tax return and avoid itemizing deductions on the other return (so the sum is not split between them). We are also assuming that when filing separately both people can claim all the dependents. Given this analysis the user should supply the following information:

The input validation part may assume that the correct type is given but should check the value. The program should loop until a legal value is provided. You should prompt the user for the information in exactly the same order as described above, repeating a request if an illegal value is provided.

You should then calculate the tax due for each option and write a report. For each option, the report should include the the tax for individual people if filing separately, and in any case the total tax for that option. At the end the option with the lowest tax due should be pointed out; if several options give the same minimum amount then the first one should be chosen. The report is illustrated in the following examples. Note that each amount printed (as well as the choice of option) is preceded by a $ sign. You must include the $ sign before the number as our automatic grader will look for it when analyzing your output. There should be at least one space between the $ sign and the number. You should not include any other $ signs in your output as this will confuse the grader. All dollar amounts must be printed in fixed format and with two fraction digits. Note that while debugging your program you might find it useful if the second function printed a full report similar to pp2, but this must be omitted in the submission.

Using functions: Your code must include at least 2 functions. The first is a function that prints the initial information to the user. The second is a function that takes all the relevant parameters of a tax return (single/joint, income, number of dependents, whether itemizing deductions and the sum if itemizing) and calculates the tax for this option. You may also use any other functions in addition to the 2 above.

Programming style guidelines for this week

To get the style point, you must satisfy all of the following requirements.

Your first submission will be used for style grading, even if your best grading score is on a different submission.

Submitting your program

Assuming your program is in a file named taxrec.cpp which is in the current directory on andante, you should submit by typing (or substitute your file name instead of taxrec.cpp)
provide comp11 pp4 taxrec.cpp


Examples: The following examples illustrate the requirements. The information provided by the user is given in bold. Try to redo the calculations in the examples to make sure you get the right results.

-------------------------------------------------------------
           This is a tax recomendation system.
It will help you decide whether to file separately or jointly
and whether to itemize deductions or not.

When prompted for the sum for itemized deductions
please enter the maximal amount you can claim and the system
will find out what is the best option for you.
-------------------------------------------------------------
Please enter name of first person: Rhea
Please enter total income for first person: 108000
Please enter name for second person: Chronos
Please enter total income for second person: -99000
Please enter total income for second person: 99000
Please enter the number of dependents (0 for none): 4
Please enter itemized deductions amount: 11300
Option (1) file jointly and itemize deductions
Total tax due is:       $   48810.00

Option (2) file jointly and not itemize deductions
Total tax due is:       $   47700.00

Option (3) file separately and first person itemizes deductions
Tax for Rhea is: $ 22110.00
Tax for Chronos is: $ 16950.00
Total tax due is:       $   39060.00

Option (4) file separately and second person itemizes deductions
Tax for Rhea is: $ 24000.00
Tax for Chronos is: $ 15060.00
Total tax due is:       $   39060.00

Option (5) file separately and not itemize deductions
Tax for Rhea is: $ 24000.00
Tax for Chronos is: $ 16950.00
Total tax due is:       $   40950.00

The best option is option $ 3

-------------------------------------------------------------
           This is a tax recomendation system.
It will help you decide whether to file separately or jointly
and whether to itemize deductions or not.

When prompted for the sum for itemized deductions
please enter the maximal amount you can claim and the system
will find out what is the best option for you.
-------------------------------------------------------------
Please enter name of first person: Hera
Please enter total income for first person: 30800
Please enter name for second person: Zeus
Please enter total income for second person: 19900
Please enter the number of dependents (0 for none): -2
Please enter the number of dependents (0 for none): 0
Please enter itemized deductions amount: 3000
Option (1) file jointly and itemize deductions
Total tax due is:       $    6285.00

Option (2) file jointly and not itemize deductions
Total tax due is:       $    4485.00

Option (3) file separately and first person itemizes deductions
Tax for Hera is: $ 3735.00
Tax for Zeus is: $ 1800.00
Total tax due is:       $    5535.00

Option (4) file separately and second person itemizes deductions
Tax for Hera is: $ 3435.00
Tax for Zeus is: $ 2100.00
Total tax due is:       $    5535.00

Option (5) file separately and not itemize deductions
Tax for Hera is: $ 3435.00
Tax for Zeus is: $ 1800.00
Total tax due is:       $    5235.00

The best option is option $ 2

About this document ...

This document was generated using the LaTeX2HTML translator Version 98.1p1 release (March 2nd, 1998)

Copyright © 1993, 1994, 1995, 1996, 1997, Nikos Drakos, Computer Based Learning Unit, University of Leeds.

The command line arguments were:
latex2html -split 0 -no_navigation -no_images -dir TEMPHTML pp4.tex.

The translation was initiated by Roni Khardon on 2002-10-03


Roni Khardon
2002-10-03