SYCS-135 INTRODUCTORY PROGRAMMING

ASSIGNMENT 5

Due Date: October 7, 1999

Problem:� You still have not filed your 1998 tax returns.� Write a program to calculate the Federal, State and City income taxes that you owed in 1998 and determine whether you will receive a refund or will need to pay more taxes.�

���������������������������������������������������������������������������������������������

The total income taxes that you must pay for 1998 or your refund in 1998 is� determined as follows:

Let total_tax =� amount of taxes owed (you will calculate total_tax = federal tax + state tax + city tax).�

If total_tax is greater than the total amount of tax already taken from your salary (you will find these amounts from your input data), then you must pay additional taxes of total_tax minus the taxes already taken from your salary.

If total_tax is less than the total amount of tax already taken from your salary then you will receive a refund equal to the difference between the taxes already taken from your salary and total_tax.

Federal tax = 15% of your taxable income that is <= $25,000� + 25% of any of your taxable income above $25,000

where:

taxable income = gross salary - (no. of dependents * $1,000) - (no. of deductions * $375)

State tax = 10% of Federal tax unless Federal tax < $200 then State tax = 0.

City Tax = 8% of State tax unless State tax <= $100 then City tax = 0.

Input: �the input data stream format is:

type of datum����������� meaning

characters���������������� year� (1998)

integer�������������������� social security number� (9 digits)

float����������������������� gross salary

float����������������������� federal tax already taken from salary

float����������������������� state tax already taken from salary

float����������������������� city tax already taken from salary

integer�������������������� number of dependents

integer�������������������� number of deductions

Create an external file named tax.txt.� Name your input file readinstuff and include the following statement in your program: readinstuff.open(�tax.txt�);.

Run your program twice, first with the following input data:

1998��� 949581726�� 26000.00��� 5000.00��� 495.00��� 258.00���� 4��� 6

and then with a set of your own data.

Output:� Write out the input data, and then write out the federal, state and city taxes owed by you in 1998.� If you owe taxes, write out these amounts indicating that you owe them.� If you are owed any refunds then write out these amounts indicating that they are refunds.� You will be graded on the correctness, neatness and clarity of your output so choose your headings carefully and line up your output neatly.�

Requirements: Use conditionals and at least one function with parameters.

ASSIGNMENT SUBMISSION: �Hand in a hard copy of your algorithm in pseudocode, your test oracle and desk-checking calculations, your C++ program compilation listing, and two output listings obtained from running your program with the two different sets of data.

Pseudocode:� A 1-page description of your algorithm in pseudocode.

Test Oracle:� Choose one or more sets of data in addition to the specified set.� For each set, use your algorithm to calculate by hand (you can use a calculator) the answer to the problem and write down this answer.

Program Output:� First print out the your name, course number and title, assignment number, and date, followed by a description of the problem. Use the void function you developed in Assignment #4.

Print the input data with appropriate headings, followed by the answer to the problem as specified above.� All money amounts must be printed as dollar and cents amounts.

Program Documentation:� At the top of your source code as a comment, include your name, course number and title, assignment number, and date, followed by a description of the problem.� Include comments as necessary throughout your program to illustrate the algorithm, logic of flow, meaning of variables etc.� Follow the style guidelines described in class.

---------------------------------------------------------
Electronic Submission - SCS Laboratory
All C++ program assignments are now to be submitted electronically. Your
program will be run using the instructors' data. For Assignment 5, name
your C++ program file assign5.c and use the following command to submit
your program:
$ Keeling assign5.c
The assignment is to be submitted electronically no sooner than 12:00 noon on Wednesday, Oct.. 6, 1999 and no later than 10:00 PM on October 6, 1999. The receiving file will be closed at 10:00 PM and no late assignments will be accepted. If before October 6th, you send in a version of your assignment, having already sent in an earlier version, the later version will automatically replace the earlier version in the assignment file.
---------------------------------------------------------
Electronic Submission � via E-mail
Your program can be submitted via E-mail. If you select this mode of submission then you must make sure that you make the subject of your message �assign5.c � and use the following E-mail address

�������� [email protected]

The body of the message should be your source code listing with the program�s output in comments.