CSC 160 Fall 2008 Homework 10
Assigned Nov 24, Due MONDAY Dec 1


Reread Sections 15.1-15.5 of the textbook.

Do the following exercises:
1. Develop the function: on-top?. It takes a point and returns true if it is in the uppermost 50 pixels of the window.

2. Exercise 15.3.2: Develop the function: above-diagonal?. It takes a point and returns true if the point is above the diagonal. [Hint: In Scheme the diagonal goes from the top left corner (also known as the origin) to the bottom right corner.]

BEFORE CONTINUING, COPY AND PASTE THE DISTANCE PROGRAM FROM THE CHAPTER 15 LECTURE SLIDES INTO THE DEFINITIONS PANE.

3. Develop the function: within-distance?. It takes in two posns and a number, and tells whether the posns are within that distance of one another. (Hint: You will need to call the distance function written in class!)

4. For extra credit, develop the function: find-area. It consumes two Posn structures -- one representing the center of a circle and the other representing a point on its circumference -- and produces the area of the disk enclosed by the circle. Remember that the Area of a disk = PI * r * r. (Hint: You will need to call the distancearea-of-disk.)



Grading Contract Purpose Examples Skeleton Inventory Definition Testing
Question 1 /3 /2 /3 /3 /4 /12 /3
Question 2 /3 /2 /3 /3 /4 /12 /3
Question 3 /3 /2 /3 /3 /8 /18 /3
Extra Credit /2 /2 /2 /2 /2 /8 /2



Last Modified: 11/28/08