Ch07 WS 03

  1. 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.

    1. Write two check-expects for f.
    2. Write the function definition.
  2. 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))
    
    1. What is the signature of the draw handler?
    2. Make a careful drawing of the initial image you see.
    3. Write the draw handler.
    4. What is the signature of the tick handler?
    5. Make a careful drawing of one tick after the start of the animation.
    6. Write the tick handler.
    7. What is the signature of the mouse handler?
    8. Write a check-expect showing what happens when the radius is 70 and the mouse moves to (180,140).
    9. Write the mouse handler.
Last modified August 18, 2023: 2022-2023 End State (7352e87)