Question: In Java please. Include comments for what your doing if possible. Do NOT import or use any classes other than ones provided in the java.lang

In Java please. Include comments for what your doing if possible. Do NOT import or use any classes other than ones provided in the java.lang package or specified in the QUESTION. You can use String, Object, any primitive Wrapper class (Integer, Double, etc.).

Link for converting temperatures: https://en.wikipedia.org/wiki/Conversion_of_units_of_temperature

Student number: 101074461. Source code below! need help modifying this! thanks.

In Java please. Include comments for what your doing if possible. Do

/** * A Temperature object represents temperature (with a value and scale) * * COMP 1006/1406 * Summer 2018 * Assignment 2 */ public class Temperature{ /** different scale names */ public static String[] scales = {"Celsius", "Fahrenheit", "Kelvin"}; /** Initializes a temperature object with given value in Celcius * * If the initial temperature is less than -273.15 then the temperature * object will be initialized with -273.15C. * * @param temp is the initial temperature in Celsius. */ public Temperature(double temp){ } /** Initializes a temperature object with given value using the specified scale *  * If the temperature is lower than absolute zero, then set the temperature to * absolute zero (in whichever scale is specified). *  * Examples: new Temperature(12.3, "K") * new Temperature(-90.2, "Celsius") * * @param temp is the initial temperature * @param scale is the scale of initial temperature and must either be * one of the Strings in the scales array, or * the first letter (capitalized) of one of those strings. */ public Temperature(double temp, String scale){ } /** getter for the scale * * The output of this getter method must always be the first letter of one * of the strings in the scales array, capitalized. * * @return the current scale of the object as a single char (the first letter, * capitalized of one of the strings from scales) */ public char getScale(){ return 'X'; } /** getter for the temperature * * @return the temperature of the object using the current scale */ public double getTemp(){ return -Double.MAX_VALUE; } /** setter for scale * * * * @param scale is the new scale of the temperature and must either be * one of the Strings in the scales array, or * the first letter (capitalized) of one of those strings. */ public void setScale(String scale){ } /** setter for temperature * * @param temp is the new temperature (in the objects current scale) */ public void setTemp(double temp){ } /** setter for temperature * * * @param temp is the new temperature * @param scale is the scale of the new temperature. It must be * the first letter (capitalized) of one of the strings in * the scales array. */ public void setTemp(double temp, char scale){ } /** setter for temperature * * @param temp is the new temperature * @param scale is the scale of the new temperature. It must be one * of the strings in the scales array, or the first letter * (capitalized) of one of those strings. */ public void setTemp(double temp, String scale){ } /* ------------------------------------------------- */ /* ------------------------------------------------- */ /* do not change anything below this */ /* ------------------------------------------------- */ /* ------------------------------------------------- */ /** String representation of a temperature object */ @Override public String toString(){ return "" + this.getTemp() + this.getScale(); } }

1: Temperature Complete the provided Temperature class. Add any attributes and helper methods as needed. You must complete the constructors and methods in the provided class (without changing any signatures, return types, or modifiers) In this problem you will need to be able to convert temperatures between Celsius, Fahrenheit and Kelvin. For help, see https://en.wikipedia.org/wiki/Conversion of units_of_temperature A temperature object holds a single temperature and displays it in one of the three scales. Once a scale has been set, it will display the temperature in that scale until changed. The default scale is Celsius if not specified Examples: Temperature t -new Temperature (10.1); System.out.println(t.getScale)) System.out.println(t); t.setScale("F") System.out.println(t); System.out.println(t.getScale)) // outputs the char C' // outputs 10.1C // outputs 50.18F // outputs the char 'F When you set a temperature (without explicitly stating the scale), whatever scale is currently used by the object will be used. Note: Repeatedly changing the scale should not "change" the value of the temperature. For example, Temperature t = new Temperature (10.1); System.out.println(t); for (int i-0; iK10000; i+-1) t.setScale("F") t.setScale("C") System.out.println(t); Should print out identical strings Note: You should have no static attributes or methods in your class (unless they were supplied in the starter code Note: Your code must use encapsulation. Your grade will be reduced by 5 marks if you do not use encapsulation

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!