Home / Expert Answers / Computer Science / write-the-code-in-java-question-details-a-two-dimensional-array-of-temperat-pa516

(Solved): WRITE THE CODE IN JAVA Question Details: A two-dimensional array of temperat ...



Question Details:
A two-dimensional array of temperatures is represented in the following class. (You must use arrays for thiComplete method computeTemp below:???????

WRITE THE CODE IN JAVA

Question Details: A two-dimensional array of temperatures is represented in the following class. (You must use arrays for this assigment. If you use classes from java.util package, you will get 0 .) public class TemperatureGrid \{ A two-dimensional array of temperature values, initialized in the constructor (not shown) Guaranteed not to be null private double [][] temps; private double computeTemp (int row, int col) public boolean updateAllTemps (double tolerance) There may be instance variables, constructors, and methods that are not shown. \} Part1: Write method computeTemp, which computes and returns the new temperature for a given element of temps according to the following rules. 1. If the element is in the border of the array (in the first row or last row or first column or last column), the new temperature is the same as the old temperature. 1. Otherwise, the new temperature is the average (arithmetic mean) of the temperatures of the four adjacent values in the table (located above, below, to the left, and to the right of the element). If temps is the table shown below, temps. length is 5 and temps [0]. length is 6 . The following table shows the results of several calls to computeTemp Function Call Result Complete method computeTemp below:


We have an Answer from Expert

View Expert Answer

Expert Answer


We have an Answer from Expert

Buy This Answer $5

Place Order

We Provide Services Across The Globe