Question: I am trying to write a java programm that could find the maximum temp from an array of temperatures and find out how many time

I am trying to write a java programm that could find the maximum temp from an array of temperatures and find out how many time that temp appare in the array, however, i am not quite sure how to use the constructor and the method to do the task. The programm has to work in this frame with out change any constructor and method. Java Se8
import java. util. Arrays public class MaxTemp t1 and t2 are considered close enough if Math abs (t1-t2)EPSILON public static final double EPSILON-0. 01 private double maxtemp private Temperature[] Temp; add attributes as you need constructor t/ public MaxTemp (Temperature[] temperatures) for (int 1-0, i temperatures. ength:1+1){ Temperature T-new Temperature (i); T. setScale('K*); Temp [i] getter public double[] getMaxO -returns an array of length 2 [max, count where max is the maximum temperature (expressed in the Kelvin scale) of all Temperature objects passed to the constructor, and count is the number of times that temperature was present (in the input array of the constructor) //If there are no temperatures then return the array [o. 0, 0. 0] double result[] -new double [2] Temperature largest = Temp[0]; for(int i 0i Temp. 1ength;i+1) - new double em return new double [] f0. 1, 0.2, 0. 3, 0. 4) OPTIONAL-use your main method to test your code public static void main(Stringl] args) / testing code here is optional
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
