Home / Expert Answers / Computer Science / write-a-class-temperature-that-represents-temperatures-in-degrees-for-both-fahrenheit-celsius-and-pa944

(Solved): Write a class Temperature that represents temperatures in degrees for both Fahrenheit, Celsius, and ...




Write a class Temperature that represents temperatures in degrees for both Fahrenheit, Celsius, and kelvin. Use a floating po
Write a class Temperature that represents temperatures in degrees for both Fahrenheit, Celsius, and kelvin. Use a floating point number for the temperature and a character for the scale(Either C, F, or K). Include: 1. 4 Constructors: 1. One for setting degrees 2. One for setting scale 3. One for setting degrees and scale 4. a Default constructor 5. For each of these constructors, assume 0 degrees if no temperature is given and Kelvin if no scale is given. 2. Accessor Methods(only make these, and not others) 1. One to return the temperature in degrees Celsius 2. One to return the temperature in degrees Fahrenheit 3. One to return the temperature in degrees Kelvin 4. Round these numbers to the nearest 10 th of a degree 5. For these you are just returning the temperature as a double, not printing anything 3. Three mutator methods: 1. One to set degrees 2. One to set scale 3. One to set both 4. Three comparison Methods 1. One to test whether 2 temperatures are equal 2. One to test whether one temperature is greater then another 3. One to test whether one temperature is less than another 5. readinput Method 1. This will ask the user to enter the temp and scale 6. writeOutput Method 1. This will print the temp and scale 7. Create a driver program that includes 1. Ask a user for how many temps they have 2. Create an array of temps of that size 3. Ask the user to input the all the values in the array


We have an Answer from Expert

View Expert Answer

Expert Answer


Constructors for all the 4 cases are implemented and given below: public Temperature(double temperature, char scale) { this.temperature = temperature;
We have an Answer from Expert

Buy This Answer $5

Place Order

We Provide Services Across The Globe