CSC 160 Fall 2008 - Homework 6
Assigned Oct 29, due WEDS Nov 5
Read Chapters 9-11 of the textbook (skipping the sections and
exercises on Animations as well as Section 10.7).
Directions
Read these directions carefully before
starting the assignment.
The assignment may be done alone or
in pairs using the ideas in the Pair
Programming article.
You cannot pair up with the same
person more than once during the semester.
If you are doing the
assignment in pairs, please submit only one set of files with both names
on it. Whenever defining a Scheme function, you must
show all six steps of the Design Recipe introduced in Chapter 5.
If you are defining auxiliary functions, you need to show the 6 steps
of the Design Recipe for each of the auxiliary functions, as well as the 6
steps of the Design Recipe for the main (or primary) function. When
writing a program, the name of the main (or primary) function is the name
of the program. Use sensible names of your choice for auxiliary
functions.
If an auxiliary function is not predefined, but you
have seen it written before (e.g. in class, on a reading assignment, or on
a previous programming assignment), just copy the function definition (no
contract, skeleton, etc.) into the top of your Definitions Pane.
For the given exercise, to receive full credit, you must use at least
one
auxiliary function that is not predefined in DrScheme or any of the
teachpacks. However, functions that we have written before (including
area-of-disk and mirror-image) do count as auxiliary functions.
If
you do not fully understand any of the directions above or the questions
below, please e-mail me as
soon as possible.
The Assignment
Exercise
9.3.5 from the textbook:
The nation of Progressiva
has a simple tax code. The tax you pay is your salary times the tax rate,
and the tax rate is 0.5% per thousand dollars of salary. For example, if
you make $40,000, your tax rate is 0.5 times 40, which is 20%, so you pay
20% of $40,000 which is $8,000. Develop a Scheme program to compute
the net pay (i.e. pay after taxes) of a person with a given salary.
[Hint: You'll probably need one or two auxiliary functions along with the
net-pay function.]
Extra Credit (10 points): Answer
the following question in a comment at the bottom of your Definitions
Pane:
If the tax rate rises to 0.6% per thousand
dollars of salary, what would you need to modify in your program to handle
this change?
Submitting your Assignment
Please submit this assignment in a single Definitions Pane and a single
Interactions Pane through Moodle. Points will be deducted for completing
the assignment with multiple Definitions and/or Interactions
Panes.
Be sure to include your first and last name as a comment in
the first line of both your Definitions Pane and Interactions
Pane.
The file name for the Definitions Pane needs to be
"hw6[LastName]Def.scm" where: [LastName] is replaced with your last
name. For example, if I were submitting this assignment, I would name
the file "hw6WittensteinDef.scm".
Similarly, the file name for the
Interactions Pane needs to be "hw6[LastName]Int.scm". The Interactions
Pane must include testing for EACH function.
If these filenames are not used, points will be deducted from the
assignment grade.
| Grading |
Contracts |
Purposes |
Examples |
Skeletons |
Inventories |
Definitions |
Function Re-Use |
Testing |
| Exercise 9.3.5 |
/8 |
/6 |
/8 |
/6 |
/6 |
/40 |
/20 |
/6 |
Last Modified: 11/2/08