Sem.I Final 2021
Final exam, Parts A and B.
Part A
You are working in people coordinates to determine if a point is inside this 200x100 shape. People coordinates in this problem means $(0,0)$ in the lower left. The rounded corners are quarters of radius 50 circles. There is an animation to demonstrate, but you do not need to write the animation!
- Create this shape in DrRacket.
- The purpose of
in-shape?: number(x) number(y) -> boolean
is to return true if the point (x,y) is inside this shape. Write:- Write a check-expect that returns true.
- Write a check-expect that returns false even though the point (x,y) is inside the rectangle with $0\le x \le 200$ and $0 \le y \le 100$.
- Write the
in-shape?
function.
Part B
- Simplify as much as possible.
(define (clean-teeth? minutes-brushing toothbrush? sugar-toothpaste?)
(and (boolean=? true toothbrush?)
(and (boolean=? sugar-toothpaste? false)
(boolean=? (not (< minutes-brushing 2))
true))))
- Identify the type of model and write the draw handler (only!). A radius 10 solid red circle rotates around just inside the perimeter of a solid yellow circle of radius 100. The red circle should be able to follow the mouse around the circle.
- Make an animation that will show a given word until you click again.
- The background is 300x200.
- Clicking on a 50x50 square the lower right corner shows “woof”.
- Clicking on the same sized square in the lower left corner shows “rowr”.
- Clicking anywhere else shows nothing (blank).
The red dots below show where the clicks occurred.