Part 1 Define the functions celsius->kelvin and fahrenheit->celsius, and celsius->fahrenheit based on these formulas:
Degrees Celsius =
(Degrees Fahrenheit - 32)* 5/9
Degrees Kelvin = Degrees Celsius + 273.16
Degrees Kelvin = Degrees Celsius + 273.16
Remember to write a contract, purpose statement, and examples before you write your functions' bodies.
Part 2 Now write the rest of the temperature-conversion functions:
- fahrenheit->kelvin
- kelvin->celsius
- kelvin->fahrenheit
Part 3 Write three functions:
- kelvin->thermometer
- celsius->thermometer
- fahrenheit->thermometer
![]() |
![]() |
![]() |
| 40C | 90C | 25C |
Here are a few hints:
- Don't write the hard part of this function three times. Instead figure out a way to reuse what you've already written.
- Stacking images together Look up the move-pinhole function in the documentation.
- The rectangle function requires you to give it exact integers that are greater than zero for the width and height; fractions and zero are not allowed. To make sure you give it an exact integer you may find it useful to round numbers occasionally; you can use the built-in DrScheme functions floor and ceiling for that purpose (look them up in the Help Desk for more information).
Jacob Matthews
jacobm at cs.uchicago.edu
Hinds 026


