Question: Write this program in java, it should have 2 classes and an enum. So far i have had this answered twice and the output was

Write this program in java, it should have 2 classes and an enum. So far i have had this answered twice and the output was incorrect. I may just need to cancel my subscription to this site if I cant get a correct answer. Write a class called Temperature that represents temperatures in degrees in both Celsius and Fahrenheit. Use a floating-point number for the temperature field and an enum for the Scale, it should have C for Celsius or F for Fahrenheit. The class will have four constructors: one for the number of degrees, one for the scale, one for both the degrees and the scale, and a default constructor. For each of these constructors, assume zero degrees if no value is specified and Celsius if no scale is given. The class will have two accessor methods: one to return the temperature in degrees Celsius, the other to return it in degrees Fahrenheit. (Use the formulas from the Practice Program 5 of Chapter 3 and round to the nearest tenth of a degree.) The class will have three mutator methods: one to set the number of degrees, one to set the scale, and one to set both. The class will have three comparison (boolean) methods: one to test whether two temperature objects are equal, one to test whether one temperature is greater than another, and one to test whether one temperature is less than another. Along with the Temperature class and the enum Scale, create a third file which will be a separate driver program called TemperatureDriver to properly test all of the above methods. Be sure to invoke each of the constructors, to include at least one true and one false case for each of the different comparison methods, and to test at least the following three temperature pairs for equality: 0.0 degrees C and 32.0 degrees F, -40.0 degrees C and -40.0 degrees F, and 100.0 degrees C and 212.0 degrees F. 25 Point Bonus: Expand the project code to properly and correctly add the Kelvin temperature scale not only in the Temperature class and the enum Scale but including the appropriate additional code in the TemperatureDriver class.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!