CSC 160 Fall 2005 Homework 3
Assigned Sept 27, due SUNDAY Oct 9, revisions due SUNDAY
Oct 16
Read Chapter
4 of the textbook (pages 29 to 44).
Submitting this Assignment
--For each function, be sure to follow the design recipe. Write all the
function purposes, contracts, examples, skeletons, and function
definitions in the same Definitions Window. Save as hw3[LastName]Def.scm.
--Also test each program. Save the resulting Interactions window as
hw3[LastName]Test.scm.
--Send an email to Wittenstein@adelphi.edu.
Be sure to include your name!
The Assignment
1) Include at least 3 examples. Develop the function: within?
It consumes two numbers representing the distance d of a point from the
origin and the radius r of a circle centered around the origin. It returns
true if the point is within or on the circle. It returns false otherwise.
[Hint: related to section 4.2]
2) Include at least 3 examples. Develop the function: not-a-teenager?
It returns false if someone is between the ages of 13 and 19, and true
otherwise. [Hint: related to section 4.2]
3) Include at least 4 examples. A manufacturing company measured the
productivity of its workers in the afternoon and evening and found that
between the hours of 1:00 and 4:00 they could produce 30
pieces/hour/worker; between 4:00 and 8:00 they could produce 40
pieces/hour/worker; and between 8:00 and 11:00 they could produce 35
pieces/hour/worker. Develop a function that takes an hour of the day
between 1:00pm and 11:00pm along with the number of workers, and computes
the total number of pieces produced during that hour. Note that the 1:00
hour goes from 1:00-1:59, the 4:00 hour goes from 4:00-4:59, etc. [Hint:
related to section 4.4]
| 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 |
/4 |
/4 |
/4 |
/4 |
/20 |
/4 |
Last Modified: 10/20/05