SYCS-135
INTRODUCTION TO PROGRAMMING
ASSIGNMENT 6
Due Date: October 14 ,1999
Problem:��� Several of your friends have
not filed their 1998 tax returns and have asked you to help them complete the
forms.� In fact one of your friends has
not yet filed her 1997 tax returns.� You
also found out that you had misread the procedure for calculating the Federal
tax.� Modify your program from
Assignment 5 to read in multiple sets of data, and use the correct procedure
below for calculating Federal tax.
The total income taxes that
you must pay in a particular or your refund in that year 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 but <= $50,000 +
35% of any of your taxable
income in excess of $50,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
2 characters������������������������������������������������ taxpayer
initials
4 characters������������������������������������������������ year
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�);.
Use following input data for
your first run then make up at least 2 more sets of data:
CW 1998���� 949581726��� 26000.00�����
5000.00������� 495.00����� 258.00 4���������� 6
(add additional sets of data here)
Output: For each individual's set of tax data, write out the input data, then
write out the federal, state and city taxes owed in the specified year.� If taxes are owed, write out these amounts
indicating that they are owed.� If
refunds are due then writ 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 iteration and test for an end of file (EOF).� From now on, you
are expected to use
functions in all your assignments.
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 your output obtained from running your program with
the several sets of data.
Pseudocode: A 1-page description of your algorithm in pseudocode.
Test Oracle: Choose several sets of data in addition to the specified set described
above.� For each set, use your algorithm
to calculate by hand (you can use a calculator) the answer 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 6,
name your C++ program file assign6.c and use the following command to submit
your program:
$ Keeling assign6.c
The
assignment is to be submitted electronically no later than 10:00 PM on October 13, 1999.�
The receiving file will be closed at 10:00 PM and no late assignments
will be accepted.� If before
October� 13th, 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 "assign6.c " and use the following E-mail
address
The body of the message
should be your source code listing with the program's output in comments.