## Exercise Class `Thermometer`

Part 1: Design and realize a Java class `Thermometer` to represent thermometers. The following functionalities are of interest for thermometers:

• creation of a new thermometer, for which the measured temperature is 0 (use integers to represent temperatures).
• measurement: updates the measure of the thermometer with the temperature passed as parameter (measured in degrees Celsius).
• celsius: returns the temperature measured in degrees Celsius.
• fahrenheit: returns the temperature measured in degrees Fahrenheit.
• type: returns a string representing the type of the temperature, according to the following table:

temperature t type
45 < t `"very hot"`
35 < t <= 45 `"hot"`
18 < t <= 35 `"medium"`
0 < t <= 18 `"cold"`
t <= 0 `"very cold"`

To convert degrees Celsius in degrees Fahrenheit, use the following conversion formula: f = c * 9/5 + 32.

Part 2: Write a client that uses the class `Thermometer` as follows.

1. It creates a thermometer.
2. It reads twice the temperature of the thermometer from the keyboard and prints out the information about the thermometer (i.e., temperature in Celsius, temperature in Fahrenheit, type of the temperature, i.e., one of `"very hot"`, `"hot"`, etc.). To print out the information, make use of an auxiliary method.
3. If for the two readings the type of the temperature coincides, it prints `"The temperature did not change."`, otherwise it prints ```"Attention, the temperature has changed."```.

Part 3: Write a static method outside the class `Thermometer` that, given a thermometer, repeatedly reads from the keyboard the temperature in Celsius passing it to the thermometer as measurement. The method should stop reading from keyboard when `JOptionPane.showInputDialog` returns `null`, i.e., the user has pressed the `Cancel` button. At this point the method returns the maximum temperature, in Fahrenheit, among those read.

Part 4: Write a static method outside the class `Thermometer` that, given a thermometer, repeatedly reads from the keyboard the temperature in Celsius passing it to the thermometer as measurement, and at the end returns the average temperature in Fahrenheit. Again, the method should stop reading from keyboard when `JOptionPane.showInputDialog` returns `null`.