17. Review Restart 3
-
You are on time if it is a school day an dtime is less than 800. You are also on time if it is not a school day, no matter what time it is.
on-time? : number (time) boolean(school-day?) -> boolean
-
An egg is “hard” if cooked 10 minutes or more, “raw” if cooked less than 6 min, and “soft” if it is cooked 6-10 min.
egg-cook: number(minutes) -> string
-
A deluxe burger costs $8 plus $3 each patty, and $2.25 extra if you want bacon. Write the function and two checks - one with bacon and one without.
burger-cost: number(patties) boolean(bacon?) -> nubmer
-
A concert costs $75 for basic “300” level seating, $125 for “200” level seating, $190 for “100” level seating, and $250 for “floor”. There are a limited number of backstage passes available for an extra $200.
concert-cost: string(seating) boolean(backstage?) -> number
The basic version of this function only works with the strings mentioned in the problem. An advanced version of this function also works with other numbers is the 100-399 range, like this:
(check-expect (concert-cost "230" false) 125)
-
This draw function has three options.
;; q5 : number -> image
Options:
- Number 1-2: draw pic:bloch
- Number 3-4: draw pic:hacker
- Number 5 or more: draw pic:hieroglyphics scaled by n-3.
-
Make a picture of a burger according to the description below.
pic-food: number(burgers) boolean(cheese?) boolean(tomato?) -> image
There is a always a bun on the top and bottom (you can use a tan rectangle), then tomato, cheese, and burger patties. Each burger patty is 15 pixels high and 100 wide. Make the others look good (maybe a height of 5 for the cheese and 10 for the bun).
An example of
(pic-food 1 true true)
is shown below. -
A simple counting game.
- the model is a number
- draw handler: draw the number as black text inside a black outline circle
- tick handler: the number goes up by 5 every 0.3 seconds
- losing: If the number is between 500 and 1000, you lose and the number shows in red.
- winning: If the number is above 1000 you win and the number minus 1000 shows in green.
- key handler: hit “w” to win