-
-
Save jakemayeux/6a0ea8e4f60457cdcc16a22f410d9a57 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(define SHEEP .) | |
(define SCENE (empty-scene 500 500)) | |
(define CAR .) | |
(define BALLOON .) | |
(define CAKE .) | |
;;Exercise 3 | |
(define (letter-grade score) | |
(if (> score 90) "A" | |
(if (> score 80) "B" | |
(if (> score 70) "C" | |
(if (> score 60) "D" "F"))))) | |
;;Exercise 4 | |
(define (how-long min) | |
(if (< min 10) "Great!" | |
(if (<= min 60) "Okay" "Not Good"))) | |
;;Exercise 5 | |
(define (good-weather str) | |
(if (equal? str "sunny") true false)) | |
;;Exercise 6 | |
(define (str-len str) | |
(if (< (string-length str) 3) "stubby" | |
(if (< (string-length str) 11) "shorty" | |
(if (< (string-length str) 26) "middling" "too wordy")))) | |
;;Exercise 7 | |
(define (sale wish) | |
(cond [(equal? wish "car")(place-image CAR 200 200 SCENE)] | |
[(equal? wish "balloon") (place-image BALLOON 200 200 SCENE)] | |
[(equal? wish "cake") (place-image CAKE 200 200 SCENE)] | |
[else (text "Sorry, wish for something else" 20 "olive")])) | |
;;Exercise 8 | |
(define (draw-sheep x) | |
(place-image SHEEP x 200 SCENE)) | |
;;Exercise 9 | |
(define (on-top img1 img2) | |
(overlay/align "left" "top" img1 img2)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment