MUSICAL COMPOSITION:
Beethoven
Symphony no. 7,
Karajan Conductor.
Movements I - IV 33:30 |
At the end of today's class you should
HAVE READ:
KNOW:
BE ABLE TO:
DAILY QUESTION:
Fragment One |
Fragment Two |
CelsiusTemperature ct = new CelsiusTemperature
(23.2); ct = new CelsiusTemperature (10.2); |
CelsiusTemperature ct = new CelsiusTemperature
(23.2); ct.setTemperature (10.2); |
public class
CelsiusTemperature { /** Temperature. */ private double value; /** Constructor for CelsiusTemperature, takes in desired value to initialize object. */ public CelsiusTemperature (double temp) { setTemperature (temp); } /** * Set temperature to the desired value. * * Ensure that newVal >= -273.15 (absolute zero on celsius scale). * * @param newVal the desired new value. */ public void setTemperature (double newVal) { if (newVal < -273.15) { System.err.println ("Attempt to set value less than allowed."); return; } value = newVal; } } |
Sample Exam Question:
1. You are asked to write a TemperatureRecorder, which is capable of recording temperatures that are either CelsiusTemperatire, FahrenheitTemperature, or KelvinTemperature. Describe the signatures of the methods you would add to the TemperatureRecorder class. Note: don't write the implementation! Just describe the signatures.