SYCS-135
INTRODUCTION TO PROGRAMMING
ASSIGNMENT 6
Due Date for Tues./Thurs: October. 19,
2000 (Garuba)
Due Date for Mon./Wed./Fri.: October. 20,
2000 (Keeling)
Problem: Several of your friends have not
filed their 1999 tax returns either and have asked you to help them complete
the forms. In fact one of your friends has not yet filed her 1999 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
characters social security
number
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 1999 949581726
26000.00 5000.00 495.00 258.00 4 6
(add additional sets of data here)
Output: For each individuals 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 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 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 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 6, name your
C++ program file assign6k.c (for Mon./Wed./Fri - Keeling) or assign6g (for
Tues./Thurs.- Garuba) and use one of the following commands to submit your
program:
$ Keeling assign6k.c (for
Mon./Wed./Fri - Keeling)
$
Keeling assign6g.c (for
Tues./Thurs.- Garuba)
The assignment is to be submitted electronically no later than 10:00pm on Oct. 19,
2000 for Keeling's class and no later then 10:00pm on Oct. 18, 2000 for Dr.
Garuba's class. The receiving file will be closed at 10:00pm and no late
assignments will be accepted. If before the due dates, 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
If you do not have an
SCS account, 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 addresses
[email protected]
(for Mon./Wed./Fri - Keeling)
[email protected] (for Tues./Thurs.- Garuba)
The
body of the message should be your source code listing with the programs
output as comments.