ESc 014
Assignment 4 -- The Tax Man Cometh
Due: Tuesday, May 7, 2002
Objectives
- Use call-by-value and call-by-reference parameters
- Practice implicit and explicit casting
Your Mission
In honor of it being tax time, your assignment is to complete
Programming Project #2, listed on p. 339 of your text. This
assignment deals with computing property taxes from the market
prices of different houses. You'll be printing a report
showing the taxes owed on each property.
The Input
In the Course Materials
section of BlackBoard,
you'll find two files you need to download. The first
is the input file named housePrices.txt. It is
organized like this:
- The first 2 lines show the name of the assessor and the township
being assessed. These should be printed as the title
of your report.
- Each set of 2 lines thereafter show the property owner's
initials (3 characters) and the market value of his/her home.
- The last line of the file will be a 0 to be used as a sentinel.
The second file, named yourNameHere.cpp, is the starter code
you should begin with. I am providing you with the main()
function you need to use. YOU ARE REQUIRED TO USE THIS main
FUNCTION AND YOU MAY NOT ALTER IT. In order to get this
main function to work correctly, you need to write the
following functions:
- The printTitle function will take the assessor's first
name, last name, and the township being assessed as parameters.
It will display this information as the title of your report.
It will then display the column headings of the table you
need to create.
- The processData function will take the input file stream
variable as a parameter. This function will process the remainder
of the input file by reading each property owner and market value,
computing its assessed value and property taxes, and then displaying
that information in your table. Process each market value as you
read it. Don't use an array to store all the values first.
To help processData do
some of these tasks, processData will itself call a couple
of other functions described below.
- The computeTaxes function will be called by the
processData function. It will take a house's market value
as input and give back two results: the assessed value of the
property, and the tax to be collected. Be careful here. In
the report you print, the assessment value will have both dollars
and cents, but only whole dollars are considered when
computing tax (the text says that the tax rate is 125 mils per
dollar of assessed value). So cents aren't considered.
However, the figure you get for the final tax should be printed
as dollars and cents since the government will want to get every
penny it can.
- The printOneLine function is also called by the
processData function. It will print one line of
the table once a home's property taxes have been computed.
It will take four parameters (inputs): the owner's initials,
house market value, house
assessed value, and the property tax.
You may use other functions as you see fit, but you MUST use
the ones listed above.
Hints
Finally, some hints to help you get going.
- Plan your programs out first! Don't just start typing away
at the computer. Figure out what the main function I
gave you is doing and why it's calling certain functions in
a particular order.
- Part of this assignment is getting practice with call-by-reference
vs. call-by-value parameters. Figure out where you will use
each type of parameter first so
you'll have a better notion of what each function's job is.
- Don't lose points needlessly for not including everything you
need to. Read the assignment and the problem in the text
carefully. Don't forget to include the total taxes collected and
the total number of properties at the end of your table!
- Don't write your entire program all at once. Write each
function one at a time. Compile as you go. Test each one before
moving on to the next one.
Grading
This assignment is worth 50 points, divided as follows:
- 25 pts for correct and complete output
- 10 pts for correctly implementing the required functions
- 10 pts for good documentation including output formatting
- 5 pts for good C++ language usage including casting and
parameter usage
Don't forget to paste your output into your source code!
Remember to turn in both a paper and an electronic copy of your project
on BlackBoard. Name
your file with your FULL NAME along with the assignment number (e.g.
chrisfernandes_hw4.cpp)
Having trouble? Don't wait until the last minute! Come see me and get
your
$80 worth.
Administrative statement
Programming assignments are
individual projects. I encourage you to talk to others
about the
general nature of the project and ideas about how to pursue it. However,
the
technical work, the writing, and the inspiration behind these must be
substantially your own. If any person besides you contributes in any way
to the
project, you must credit their work on your homework. Similarly, if you
include
information that you have gleaned from other published sources, you must
cite
them as references. Looking at, and/or copying, other people's programs
or
written work is inappropriate, and will be considered cheating.
Return to
Assignment Index