Question: Program is to be written in java: don't change tester class. Here are the instructions: Here is the tester class code: /** * @(#)TwoDAvgTester.java *

Program is to be written in java: don't change tester class.

Here are the instructions:

Program is to be written in java: don't change tester class. Here

are the instructions: Here is the tester class code: /** * @(#)TwoDAvgTester.java

Here is the tester class code:

/** * @(#)TwoDAvgTester.java * * TwoDAvgTester application * * @author * @version 1.00 2021/1/25 */ import java.util.Scanner; public class TwoDAvgTester { public static void main(String[] args) { Scanner in = new Scanner(System.in); double[][] myArray = {{34.0, 12.0, 3.3, 14.8, 19.0, 0.5, 0.0, 13.9}, {43.9, 21.0, 4.2, 84.1, 39.9, 8.4, 12.4, 20.1}, {13.9, 9.3, 1.2, 12.3, 98.0, 22.3, 43.2, 100.9}, {12.1, 11.2, 33.4, 95.2, 78.2, 100.0, 77.2, 21.1}, {0.2, 10.2, 33.4, 4.2, 4.5, 12.5, 200.1, 1.2}, {0.4, 0.4, 8.4, 10.3, 12.3, 100.4, 12.1, 67.3}}; int nxt = 1; for(int row = 0; row  

Learning Objectives After completion of this lab, you should be able to: 1. Manipulate a 2 -Dimensional array. Createe a Java class to represent a TwoDArray type 1. Create a new Java class named TwoDArray that has a field to represent a 2- dimensional array of doubles 2. The TwoDArray class should have the following method: a. Constructor: The constructor should initialize the fields. i. Accepts a 2D array of doubles as input b. getAverage - Write a getAverage method that has 2 parameters that represent the row and the next represents the column of the 2D Array. i. This method will use the input values to find the index of the 2D array and compute and return the average of the 4 adjacent numbers around index in the 2D Array and return the answer. ii. If the index is in a corner, you will calculate the index of 2 numbers. iii. If the index is on the edge, you will calculate the index of 3 numbers. SAMPLE OUTPUT 34.0 12.0 3.3 14.8 19.0 0.5 0.0 13.9 4.2 84.1 39.9 8.4 12.4 20.1 1.2 12.3 98.0 22.3 43.2 100.9 12.1 43.9 21.0 13.9 9.3 11.2 2 10.2 33.4 95.2 78.2 100.0 77.2 21.1 0.2 33.4 4.2 4.5 12.5 200.1 1.2 0.4 0.4 8.4 10.3 12.3 100.4 12.1 67.3 Given the above 2D array the call: getAverage(0,0) + 27.95. Il average of 12.0 & 43.9 getAverage(3,4) 74.425. Il average of 98.0, 4.5, 100.0, 95.2

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!