Ch07 WS 04

  1. Write the function fix: number -> number that has the following properties:

    • input < 100 gives an output of 100
    • input > 300 gives an output of 300
    • otherwise the output is the same as the input
  2. Write the function rand5: anything -> integer. This function outputs a random multiple of 5 between 100 and 150 (inclusive).

  3. Write the function rand-shapes: anything -> image. This function outputs an image of a square next to the image of a circle.

    • The radius of the circle equal to the side length of the square.
    • The radius of the circle is one of 20, 30, 40, 50, …, 100.
  4. (Summary.) Create a random house-making function, rh : anything -> image. A house is triangle exactly fitting over a square. The width of the house should be chosen randomly among the numbers 120, 140, 160, …, 280.

Last modified August 18, 2023: 2022-2023 End State (7352e87)