Ch07 WS 03
-
The function
f
takes in a number and puts out a number. When the input is 5, the output is 30. When the input is 7, the output is 22.- Write two check-expects for
f
. - Write the function definition.
- Write two check-expects for
-
An animation uses a number model to control the radius of an orange circle centered at (150,100) on a 300x300 background. Every 0.5 seconds the radius increases by 5. When you move the mouse, the edge of the circle passes through the location of the mouse event (so the radius is set to be the distance from (150,100)).
(big-bang 80 (to-draw dh) (on-key kh) (on-mouse mh) (on-tick th 0.5))
- What is the signature of the draw handler?
- Make a careful drawing of the initial image you see.
- Write the draw handler.
- What is the signature of the tick handler?
- Make a careful drawing of one tick after the start of the animation.
- Write the tick handler.
- What is the signature of the mouse handler?
- Write a check-expect showing what happens when the radius is 70 and the mouse moves to (180,140).
- Write the mouse handler.