CMSC 15100 - Fall 2006 - Lab Assignment 1

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

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:

Part 3 Write three functions:

Each function takes a number and draws a thermometer of the temperature, where a thermometer is an image that looks like one of these:
40C90C25C
The image is always 100 pixels tall and 10 pixels wide. A completely red thermometer corresponds to the boiling point of water (100 degrees Celsius), and a completely empty thermometer corresponds to the freezing point of water (0 degrees Celsius). You may assume that the temperature given is always between these ranges. In fact, it may be useful to assume that the temperature is always at least a little higher than freezing or a little lower than boiling; you may assume that too if you want.

Here are a few hints:


Jacob Matthews
jacobm at cs.uchicago.edu
Hinds 026