CSC 160 Spring 2006 - Homework 8
Assigned Apr 4, due SUNDAY April 23
Read Chapter 4 and 5 in
the textvook.
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.
Whenever defining a Scheme function, you must
show all six steps of the Design Recipe.
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.
If you do not fully understand any of the directions above or the
questions below, please e-mail
me as soon as possible.
Programs
1) Develop a Scheme program called not-a-teenager?. It returns
false if
someone is between the ages of 13 and 19 inclusive, and true otherwise.
2) Develop a Scheme program called same-width?. It takes
in two images, and
returns whether or not they have the same width.
3) Develop a Scheme program called within-five?. It consumes two
numbers
and tells you whether or not their distance is less than 5.
4) Develop a Scheme program called within-n?. It tells you if two
numbers
have a distance of less than a third number represented by the
variable n.
| Grading |
Purpose |
Contract |
Examples |
Skeleton |
Definition |
Testing |
| Question 1 |
/3 |
/3 |
/3 |
/3 |
/10 |
/3 |
| Question 2 |
/3 |
/3 |
/3 |
/3 |
/10 |
/3 |
| Question 3 |
/3 |
/3 |
/3 |
/3 |
/10 |
/3 |
| Question 4 |
/3 |
/3 |
/3 |
/3 |
/10 |
/3 |
Last Modified: 4/4/06