Enter an initial temperature reading, which must be a number followed by C or F: 25.5F Calling Temperature2(25.500000,false) Current temperature is -3.611111C (25.500000F) Enter command (H for help): H Examples of commands: S -14.5F (to set temperature to -14.5 degrees Fahrenheit) C 93C (to change temperature by 93 degrees Celsius) Q (to quit) Current temperature is -3.611111C (25.500000F) Enter command (H for help): C -8.4C Calling changeBy(-8.400000) Current temperature is -12.011111C (10.380000F) Enter command (H for help): C 12F Calling changeByFah(12.000000) Current temperature is -5.344444C (22.380000F) Enter command (H for help): S 23F Calling setToFah(23.000000) Current temperature is -5.000000C (23.000000F) Enter command (H for help): S 19.8C Calling setTo(19.800000) Current temperature is 19.800000C (67.640000F) Enter command (H for help): Q Goodbye. |
Its child class, Temperature2, aims to "add functionality" by providing operations that allow temperatures (and changes thereto) to be expressed in Fahrenheit degrees.
You are to complete (and submit) the source code of the Temperature2 class, which has a constructor and three methods that are "stubs" and thus are in need of modification.
Take notice of the private methods in the "bottom half" of Temperature2's source code, as they should be useful to you in completing the stubs.
For testing your work, it is recommended that you use the Temp2Tester application. A sample dialog between it and a user is shown to the right. (User input is shown in boldface.) An alternative means for testing would be to use jGrasp's Workbench feature.
Submit the source code of your completed Temperature2 class (i.e., the file Temperature2.java, not the corresponding .class file) to the appropriate folder.