a) Four constructors: one for the degrees, one for the scale, one for both the degrees and scale, and a no-argument constructor. For each of these constructors, assume zero degrees if no value is specified and Celsius if no scale is given.
b) Three accessor methods: one to return the temperature in degrees Celsius, one to return the temperature in degrees Fahrenheit, one to return the temperature in degrees Kelvin.
For conversion between scales you can use the following formulas:
Celsius = 5/9 x (Fahrenheit - 32)
Kelvin = Celsius + 273.15
c) Three set methods: one to set the temperature, one to set the scale and one to set both.
d) Three comparison methods: one to test whether two temperatures are equal, one to test whether one temperature is greater than the other and one to test whether one temperature is less than the other.
e) a toString method: to display the temperature and scale. The output should look like 32° C (You can copy the degree sign from here to put in your code)
Write a test program to demonstrate your class. Be sure to use all of your methods in the test program.
Recently Asked Questions
- I need help to start this. can you please show me how to start Standard Deviation accuracy and precision A student in the lab was asked to dispense 2.00mL of
- These are the questions for the intro to econometrics. Please solve the problem below. I appreciate your help. Thank you.
- What is the meaning of Siddhartha's experience with the river in the novel 'Siddhartha'?