on-top?
. It takes a point
and returns
true if it is in the uppermost 50 pixels of the window.
above-diagonal?
. It takes in a posn and
returns true if the point is above the diagonal. [Hint: In
Racket, the diagonal goes from the top left corner (also known as the
origin) to the bottom right
corner.]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!)
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 distance
function written in
class! You
may also want to design and then use an auxiliary function
area-of-disk
.)
scale-posn
which takes in a
number and a posn, and returns a posn formed by multiplying the number by
each of the coordinates of the input posn.
For example, (scale-posn 3 (make-posn 2 5))
"should be"
(make-posn 6 15)
.Grading | Contract | Purpose | Data Analysis | Examples | Skeleton | Inventory | Add details to skeleton |
Definition | Testing |
32 points: on-top? | /2 | /1 | /3 | /3 | /2 | /2 | /2 | /15 | /2 |
32 points: Exercise 20.4.2 | /2 | /1 | /3 | /3 | /2 | /2 | /2 | /15 | /2 |
36 points: within-distance? | /2 | /1 | /3 | /3 | /2 | /3 | /4 | /16 | /2 |
Extra Credit: 20.5.3 | /2 | /1 | /2 | /2 | /2 | /2 | /2 | /10 | /2 |
Extra Credit: find-area | /2 | /1 | /2 | /2 | /2 | /2 | /2 | /10 | /2 |
Last Modified: 12/10/12