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 circle. (Hints: You will need to call the distance
function written in
class. You may also want to call the area-of-circle
function from CW4.)
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)
.swap-x-y
that takes in a posn and returns a new posn with the coordinates swapped: the x-coordinate of the output should be the y-coordinate of the input, and vice versa.
Grading | Contract | Purpose | Data Analysis | Examples | Skeleton w/Inventory |
Add details to skeleton |
Definition |
25 points: on-top? | /2 | /1 | /3 | /3 | /2 | /2 | /12 |
25 points: Exercise 20.4.2 | /2 | /1 | /3 | /3 | /2 | /2 | /12 |
25 points: within-distance? | /2 | /1 | /3 | /3 | /2 | /2 | /12 |
Extra Credit: find-area | /3 | /1 | n/a | /3 | /2 | /2 | /14 |
25 points: 20.5.3 | /3 | /1 | n/a | /3 | /2 | /2 | /14 |
Extra Credit: 20.5.2 | /3 | /1 | n/a | /3 | /2 | /2 | /14 |
Last Modified: 5/11/14