Write a Racket function named candy-temperature that takes two arguments, the recipe's temperature in degrees Fahrenheit and the elevation in feet, and returns the temperature to use at that elevation. For example:
> (candy-temperature 244 5280) ;; Denver, baby! 233.44 > (candy-temperature 302 977.69) ;; the highest point in Cedar Falls 300.04462 ;; is approx. 298m above sea level > (candy-temperature 302 -1401) ;; the Dead Sea 1401 ft below sea level 304.802
![]() |
Write a Racket function named ladder-height that takes two arguments, the length of the ladder and the distance at the base. Both are in feet. The function returns the distance up the wall reached by the ladder, also in feet. For example:
> (ladder-height 10 6) 8 > (ladder-height 13 5) 12 > (ladder-height 20 3.5) ; that's steep... be careful!! 19.691368667515217
You may want to create a function to square a number, and use it to compute the ladder's height.
Twc = 35.74 + 0.6215·Ta - 35.75·V0.16 + 0.4275·Ta·V0.16where Twc is the wind chill index in degrees Fahrenheit, Ta is the air temperature in degrees Fahrenheit, and V is the wind speed in miles/hour.
Write a Racket function named wind-chill that takes two arguments, the air temperature in degrees Fahrenheit and the wind speed in miles/hour, and returns the corresponding wind chill index. For example:
> (wind-chill 0 5) -10.509947791689996 > (wind-chill 40 5) 36.47240485832117 > (wind-chill 35 15) 25.43151479664407 > (wind-chill -10 25) ; one morning this winter... -37.46372963656345
The wind chill formula uses V0.16 in two places. Rather than computing that value twice, this is the perfect place to compute it once and give the result a name using a let expression. You may do so if you like!
> (+mod 2 3 12) 5 > (-mod 9 18 12) 3 > (*mod 6 5 12) 6 > (+mod 10 10 3) 2 > (-mod 121 104 13) 4 > (*mod 6 6 9) 0
Write a Racket procedure named in-range? that takes three numbers as arguments: two numbers to compare, and a tolerance, epsilon. in-range? returns true if its first two arguments are within epsilon of one another, and false otherwise. For example:
> (in-range? 4.95 5.0 0.1) #t > (in-range? 4.95 5.0 0.01) ;; not anymore! #f > (in-range? 5.0 4.95 0.1) ;; works both ways #t > (in-range? 5.0 5.95 0.1) #f > (in-range? 5.5 5.95 0.5) #t