Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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?

image text in transcribed

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Automating Access Databases With Macros

Authors: Fish Davis

1st Edition

1797816349, 978-1797816340

More Books

Students also viewed these Databases questions