Home Segments Top Top Previous Next

740: Practice

Using the Meter class in Segment 737 as a guide, define a class, Thermometer, that produces a drawing that looks like a mercury thermometer with a reading halfway between a given minimum and a given maximum temperature. Use the fillOval method to draw the bulb. Use the drawRect and fillRect methods to draw the rest of the thermometer. All three methods take four arguments: x, y, width, and height.