Posted: Wed Sep 30

Due: Thursday 10/1 10:00am

Submission name: w08_thermometer

The big picture

We will be making a processing program to display a thermometer. This program should display a celsius thermometer made of:

  • A large rectangle to contain the entire thermometer (in the reference image, the purple part).
  • A smaller interior rectangle to contain the temperature reading (in the reference image, the white part).
  • A second interior rectangle containing the actual temperature reading (in the reference image, the red part).
  • Hashmarks along the side for numbers.

Functions to write:

Write the following functions, they will be expanded upon in the coming days. For now, assume we are creating a celsius based thermometer from 0 - 100 degrees. (the specific colors you use do not need to be the same as in the reference image, as long as each piece of the thermometer is identifiable)

  • void drawThermometer(int x, int y, int w, int h)
    • Draw the entire thermometer, calling drawScale and drawReading (defined below) as needed.
    • (x, y) should be the upper left corner of the entire thermometer.
    • w, h should be the total width and height of the thermometer.
    • When calling the other functions, make sure that the hash marks and reading area fit within the entire thermometer. You can assume that h and w will always be reasonable enough values to fit everything we need to.
  • void drawReading(int x, int y, int w, int h, float temperature)
    • Draw the reading area of the thermometer.
    • (x, y) should be the upper left corner of the reading area box.
    • w should be the width of the reading area.
    • h should be the height of the reading area.
    • temperature should be the temperature to display.
  • void drawScale(int x, int y, int h)
    • Draw the hashmarks along the side of the temperature reading.
    • (x, y) should be the left corner of the 0 degree hashmark.
    • h should be the height of the entire temperature reading bar.

Reference Image:

a13_thermometer

The reference image includes numbers, you do not need to add them.