CSC 160 Fall 2006 - Homework 7
Assigned Nov 21, due SATURDAY Dec 2
Complete this Log Sheet, according to the
directions in PSP Chapter 3.
Read Chapter 6 in Simply Scheme.
Read Sections 4 and 5 in
How to Design Programs.
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 introduced in class on Thursday 10/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.
Write any 3 of the following 4 programs. (Each program is worth 30
points. If you choose to answer all four, you can get up to 10 points
extra credit on this assignment.)
Use these directions for
how to submit your assignments.
If you do not fully understand any of the directions above or the
questions below, please e-mail
me as soon as possible.
Programs
A) 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.
B) Develop a Scheme program called same-width?. It takes
in two images, and
returns whether or not they have the same width.
C) Develop a Scheme program called within-five?. It consumes two
numbers
and tells you whether or not their distance is less than 5.
D) 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 |
/15 |
/3 |
Question 2 |
/3 |
/3 |
/3 |
/3 |
/15 |
/3 |
Question 3 |
/3 |
/3 |
/3 |
/3 |
/15 |
/3 |
Question 4 |
/1 |
/1 |
/1 |
/1 |
/5 |
/1 |
Last Modified: 12/3/06