8.12

### Lecture 6: Multiple casesðŸ”—

This assignment is due on Tuesday, January 23 at 11:59pm. Submit it using Handin as assignment lecture6.

#### 1Booleans and conditionalsðŸ”—

Exercise 1. Copy the three conditionals below into your Definitions Window. What are their results?
 ; Exercise 1 (cond [(< 100 32) "solid"] [(<= 32 100 212) "liquid"] [(> 100 212) "gas"]) ; = ??? ; = ... ; = "liquid" (cond [(< -40 32) "solid"] [(<= 32 -40 212) "liquid"] [(> -40 212) "gas"]) ; = ??? ; = ... (cond [(< 450 32) "solid"] [(<= 32 450 212) "liquid"] [(> 450 212) "gas"]) ; = ??? ; = ...

Optional: Learn about more features of the Stepper.

Exercise 2. Design a function called bp-points to convert the patient’s systolic blood pressure into a coded value. Use the same table we used for the respiratory rate: Remember to follow the design recipe whenever you design or write a function. In particular, every type mentioned in a signature must be introduced by a data definition, except for these well-known types: Number, Image, String, Color, Boolean. Hint: If you need to review how to write a signature and a purpose statement, you can watch this additional video.

#### 2IntervalsðŸ”—

Exercise 3. Let’s design an animation of a rocket landing. This animation should have two parts: first, the rocket falls from the sky; second, the rocket stops at ground level and stays there.

So, design a function called land-rocket that takes a time t as input and returns a scene that contains a rocket. The scene should be an image that is 200 tall. Horizontally, the rocket should be centered in the scene. Vertically, the distance between the rocket and the top of the scene should be t. But if t is greater than 200, then the rocket should have landed so it should be at the bottom of the scene.

Hint: to begin with the design recipe, write a new data definition for what a Time is.