Question: Can I get help with this? public class MaxTemp{ /** t1 and t2 are considered the same if Math.abs(t1-t2) Complete the MaxTemp class. The class

Can I get help with this?

Can I get help with this? public class MaxTemp{ /** t1 and

public class MaxTemp{ /** t1 and t2 are considered the same if Math.abs(t1-t2)   Complete the MaxTemp class. The class consists of a single constructor and a single getter method . The constructor takes an array of Temperature objects as input. . The getter method either returns an array of doubles with exactly two doubles in it or returns null. If the object was created with one more more Temperature objects in the constructor's input array then the output consists of the maximum temperature of all Temperature objects passed to the constructor and a count of how many times that maximum was present in the array passed to the constructor (in that order). If zero Temperature objects were passed to the constructor (in the array) then the getter returns nul1. Note: The max temperature returned must be displayed in the Kelvin scale Note: Different Temperature objects in the array passed to the constructor may have different temperature scales set for themselves Since the Temperature objects will store a floating point number for the temperature, you will use the provided EPSILON constant in the MaxTemp class and consider two temperatures as equal if their absolute difference is smaller than EPSILON. Therefore, if Math.abs (temp1 - temp2) ESILON then templ and temp2 are considered equal For example, if the array new Temperaturenew Temperature (1001.12, "K"), new Temperature(-200.0, "F"), new Temperature (1001.11, "K")) is passed to the constructor, and EPSILON-0.1, then the getMax getter will return [1001.12, The return value should still display the maximum temperature (in K). In the example above, even though we consider 1001.11 and 1001.12 the "same", 1001.12 is still the max to be returned 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!