CSC 160 Spring 2006 - Homework 10
Assigned May 9, due SUNDAY May 14


Read Sections 6.0-6.1 of the online textbook.

Submitting this Assignment
--You may complete this assignment alone or in pairs. However you cannot use the same partner as any previous HW this semester.
--If you do the assignment in pairs, include both last names in each file name.
--For each function, be sure to follow the design recipe.
--In the Definitions Window, write all the function purposes, contracts, at least three examples, skeletons, templates, and function definitions.
--Submit one Definitions Window which includes all 3 questions. Save as hw10LastNameDef.scm.
--Also test each program. Save the resulting Interactions window as hw10LastNameTest.scm.
--For full credit, you must send exactly two files, one Definitions Window file and one Interactions Window file.
--Send both of the files in an email to Wittenstein@adelphi.edu. Be sure to include your name!
--Do not use conditionals for this assignment.
--There will be no late credit for this assignment. Programs received after 11:59 p.m. on Sunday May 14th will receive a grade of zero.
--Solutions to HW10 will be posted to the web page on Monday 5/15, as we will not have a class session to review this assignment.


The Assignment
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. Develop the function: below-diagonal?. It takes a point and returns true if the point is below the diagonal. (Hint: Remember that in Scheme the diagonal goes from the top left corner to the bottom right corner.)

BEFORE CONTINUING, COPY AND PASTE THE DISTANCE PROGRAM FROM THE MAY 9TH SLIDES INTO THE DEFINITIONS WINDOW.

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. Area of a disk = PI * r * r. (Hint: You will need to call the distance function written in class! You may also want to create an auxiliary function area-of-disk.)



Grading Purpose Contract Examples Skeleton Template Definition Testing Abstraction
Question 1 /2 /3 /3 /2 /2 /10 /3
Question 2 /2 /3 /3 /2 /2 /10 /3
Question 3 /2 /3 /3 /2 /2 /10 /3 /10
Extra Credit /1 /2 /3 /1 /1 /5 /2 /5



Last Modified: 5/7/06