(1) getTotal: This method should accept a two-dimensional array as its argument and return the total

of the values in the array. Write overloaded versions of this method that work with int, float, double, and long arrays.

(2) getAverage: This method should accept a two-dimensional array as its argument and return the average of the values in the array. Write overloaded versions of this method that work with int, float, double, and long arrays.

(3) getRowTotal: This method should accept a two-dimensional array as its first argument and and integer as its

second argument. The second argument should be the subscript of a row in the array. The method should return the total of the values in the specified row. Write overloaded versions of this method that work with

int,float, double, and long arrays.

(4) getColumnTota: This method should accept a two-dimensional array as its first argument and and integer as its second argument. The second argument should be the subscript of a column in the array. The method should return the total of the values in the specified row. Write overloaded versions of this method that work with int,float, double, and long arrays.

(5) getHighestInRow: This method should accept a two-dimensional

array as its first argument and and integer as its second argument.

The second argument should be the subscript of a row in the array.

The method should return the highest of the values in the specified

row. Write overloaded versions of this method that work with int,

float, double, and long arrays.

(6) getLowestInRow: This method should accept a two-dimensional array as its first argument and and integer as its second argument. The second argument should be the subscript of a row in the array. The method should return the total of the values in the specified row. Write overloaded versions of this method that work with int, float, double, and long arrays.

Demonstrate the class in a complete program with test data stored in two-dimensional array of various data types

**I have done everything above**

**This my 2DArrayOperations class code**

public class TwoDArrayOperations { /* The getTotal method accepts a two-dimensional array as its argument and returns the total of the values in the array. In the form of an (int). */ public static int getTotal(int [][] testOne) { int total; // Accumulator. total = 0; // Set the accumulator to 0. // Sum the array elements. for (int row = 0; row < testOne.length; row++ ) { for (int col = 0; col < testOne[row].length; col++ ) total += testOne[row][col]; } // Return the total. return total; } /* The getTotal method accepts a one-dimensional array as its argument and returns the total of the values in the array. In the form of an (float). */ public static float getTotal(float [][] testTwo) { float total; // Accumulator. total = 0; // Set the accumulator to 0. // Sum the array elements. for (int row = 0; row < testTwo.length; row++ ) { for (int col = 0; col < testTwo[row].length; col++ ) total += testTwo[row][col]; } // Return the total. return total; } /* The getTotal method accepts a one-dimensional array as its argument and returns the total of the values in the array. In the form of an (double). */ public static double getTotal(double [][] testThree) { double total; // Accumulator. total = 0; // Set the accumulator to 0. // Sum the array elements. for (int row = 0; row < testThree.length; row++ ) { for (int col = 0; col < testThree[row].length; col++ ) total += testThree[row][col]; } // Return the total. return total; } /* The getTotal method accepts a one-dimensional array as its argument and returns the total of the values in the array. In the form of an (long). */ public static long getTotal(long [][] testFour) { long total; // Accumulator. total = 0; // Set the accumulator to 0. // Sum the array elements. for (int row = 0; row < testFour.length; row++ ) { for (int col = 0; col < testFour[row].length; col++ ) total += testFour[row][col]; } // Return the total. return total; } // ============ End of the getToal method. ========== /* The getAverage method should accept a two-dimensional array as its argument and return the average of the values in the array. In the form of an (int). */ public static int getAverage(int [][] testOne) { int total = 0; // Initialize accumulator. int average; // Will hold the average. // Add up all the values in the array. for (int row = 0; row < testOne.length; row++ ) for (int col = 0; col < testOne[row].length; row++) total += testOne[row][col]; // Calculate the Average. return average = total / testOne.length; } /* The getAverage method should accept a two-dimensional array as its argument and return the average of the values in the array. In the form of an (float). */ public static float getAverage(float [][] testTwo) { float total = 0; // Initialize accumulator. float average; // Will hold the average. // Add up all the values in the array. for (int row = 0; row < testTwo.length; row++ ) for (int col = 0; col < testTwo[row].length; row++) total += testTwo[row][col]; // Calculate the Average. return average = total / testTwo.length; } /* The getAverage method should accept a two-dimensional array as its argument and return the average of the values in the array. In the form of an (int). */ public static double getAverage(double [][] testThree) { double total = 0; // Initialize accumulator. double average; // Will hold the average. // Add up all the values in the array. for (int row = 0; row < testThree.length; row++ ) for (int col = 0; col < testThree[row].length; row++) total += testThree[row][col]; // Calculate the Average. return average = total / testThree.length; } /* The getAverage method should accept a two-dimensional array as its argument and return the average of the values in the array. In the form of an (int). */ public static long getAverage(long [][] testFour) { long total = 0; // Initialize accumulator. long average; // Will hold the average. // Add up all the values in the array. for (int row = 0; row < testFour.length; row++ ) for (int col = 0; col < testFour[row].length; row++) total += testFour[row][col]; // Calculate the Average. return average = total / testFour.length; } // ============ End of the getAverage method. ========== /* The getRowTotal method should accept a two-dimensional array as its first argument and and integer as its second argument. The second argument should be the subscript of a row in the array. The method should return the total of the values in the specified row. In the form of an (int). */ public static int getRowTotal(int [][] testOne) { int total ; // Accumulator. total = 0; // Set the accumulator to 0. for (int col = 0; col < testOne.length; col++) //Sum a row. for (int row = 0; row < testOne[row].length; row++) total += testOne[row][col]; // Return the total. return total; } /* The getRowTotal method should accept a two-dimensional array as its first argument and and integer as its second argument. The second argument should be the subscript of a row in the array. The method should return the total of the values in the In the form of an (float). */ public static float getRowTotal(float [][] testTwo) { float total; // Accumulator. total = 0; // Set the accumulator to 0. // Add up all the values in the array. for (int row = 0; row < testTwo.length; row++ ) //Sum a row. for (int col = 0; col < testTwo[row].length; col++) total += testTwo[row][col]; // Return the total. return total; } /* The getRowTotal method should accept a two-dimensional array as its first argument and and integer as its second argument. The second argument should be the subscript of a row in the array. The method should return the total of the values in the In the form of an (double). */ public static double getRowTotal(double [][] testThree) { double total; // Accumulator. total = 0; // Set the accumulator to 0. // Add up all the values in the array. for (int row = 0; row < testThree.length; row++ ) //Sum a row. for (int col = 0; col < testThree[row].length; col++) total += testThree[row][col]; // Return the total. return total; } /* The getRowTotal method should accept a two-dimensional array as its first argument and and integer as its second argument. The second argument should be the subscript of a row in the array. The method should return the total of the values in the. In the form of an (long). */ public static long getRowTotal(long [][] testFour) { long total; // Accumulator. total = 0; // Set the accumulator to 0. // Add up all the values in the array. for (int row = 0; row < testFour.length; row++ ) //Sum a row. for (int col = 0; col < testFour[row].length; col++) total += testFour[row][col]; // Return the total. return total; } // ============ End of the getRowTotal method. ========== /* The getColumnTotal method should accept a two-dimensional array as its first argument and and integer as its second argument. The second argument should be the subscript of a row in the array. The method should return the total of the values in the specified row. In the form of an (int). */ public static int getColumnTotal(int [][] testOne) { int total ; // Accumulator. total = 0; // Set the accumulator to 0. for (int col = 0; col < testOne[0].length; col++) //Sum a column. for (int row = 0; row < testOne.length; row++) total += testOne[row][col]; // Return the total. return total; } /* The getColumnTotal method should accept a two-dimensional array as its first argument and and integer as its second argument. The second argument should be the subscript of a row in the array. The method should return the total of the values in the In the form of an (float). */ public static float getColumnTotal(float [][] testTwo) { float total; // Accumulator. total = 0; // Set the accumulator to 0. // Add up all the values in the array. for (int col = 0; col < testTwo[0].length; col++) //Sum a column. for (int row = 0; row < testTwo.length; row++) total += testTwo[row][col]; // Return the total. return total; } /* The getColumnTotal method should accept a two-dimensional array as its first argument and and integer as its second argument. The second argument should be the subscript of a row in the array. The method should return the total of the values in the In the form of an (double). */ public static double getColumnTotal(double [][] testThree) { double total; // Accumulator. total = 0; // Set the accumulator to 0. // Add up all the values in the array. for (int col = 0; col < testThree[0].length; col++) //Sum a column. for (int row = 0; row < testThree.length; row++) total += testThree[row][col]; // Return the total. return total; } /* The getColumnTotal method should accept a two-dimensional array as its first argument and and integer as its second argument. The second argument should be the subscript of a row in the array. The method should return the total of the values in the. In the form of an (long). */ public static long getColumnTotal(long [][] testFour) { long total; // Accumulator. total = 0; // Set the accumulator to 0. // Add up all the values in the array. for (int col = 0; col < testFour[0].length; col++ ) //Sum a column. for (int row = 0; row < testFour.length; row++) total += testFour[row][col]; // Return the total. return total; } // ============ End of the getColumnTotal method. ========== /* The getHigestInRow method should accept a two-dimensional array as its first argument and and integer as its second argument. The second argument should be the subscript of a row in the array.The method should return the highest of the values in the specified row In the form of an (int). */ public static int getHigestInRow(int [][] testOne) { /* Store the first value in the testOne array in the variable highest. */ int highest = testOne[0][0]; highest = 0; // Set the highest to 0. for (int row = 0; row < testOne.length; row++ ) { for (int col = 0; col < testOne.length ; col++) if (testOne[row][col] > highest) highest = testOne[row][col]; } // Return the highest value. return highest; } /* The getHigestInRow method should accept a two-dimensional array as its first argument and and integer as its second argument. The second argument should be the subscript of a row in the array.The method should return the highest of the values in the specified row In the form of an (float). */ public static float getHigestInRow(float [][] testTwo) { /* Store the first value in the testOne array in the variable highest. */ float highest = testTwo[0][0]; highest = 0; // Set the highest to 0. for (int row = 0; row < testTwo.length; row++ ) { for (int col = 0; col < testTwo.length ; col++) if (testTwo[row][col] > highest) highest = testTwo[row][col]; } // Return the highest value. return highest; } /* The getHigestInRow method should accept a two-dimensional array as its first argument and and integer as its second argument. The second argument should be the subscript of a row in the array.The method should return the highest of the values in the specified row In the form of an (double). */ public static double getHigestInRow(double [][] testThree) { /* Store the first value in the testOne array in the variable highest. */ double highest = testThree[0][0]; highest = 0; // Set the highest to 0. for (int row = 0; row < testThree.length; row++ ) { for (int col = 0; col < testThree.length ; col++) if (testThree[row][col] > highest) highest = testThree[row][col]; } // Return the highest value. return highest; } /* The getHigestInRow method should accept a two-dimensional array as its first argument and and integer as its second argument. The second argument should be the subscript of a row in the array.The method should return the highest of the values in the specified row In the form of an (long). */ public static long getHigestInRow(long [][] testFour) { /* Store the first value in the testOne array in the variable highest. */ long highest = testFour[0][0]; highest = 0; // Set the highest to 0. for (int row = 0; row < testFour.length; row++ ) { for (int col = 0; col < testFour.length ; col++) if (testFour[row][col] > highest) highest = testFour[row][col]; } // Return the highest value. return highest; } // ============ End of the getHighest method. ========== /* The getlowestInRow method should accept a two-dimensional array as its first argument and and integer as its second argument. The second argument should be the subscript of a row in the array.The method should return the highest of the values in the specified row In the form of an (int). */ public static int getlowestInRow(int [][] testOne) { /* Store the first value in the testOne array in the variable highest. */ int highest = testOne[0][0]; highest = 0; // Set the highest to 0. for (int row = 0; row < testOne.length; row++ ) { for (int col = 0; col < testOne.length ; col++) if (testOne[row][col] > highest) highest = testOne[row][col]; } // Return the highest value. return highest; } /* The getHigestInRow method should accept a two-dimensional array as its first argument and and integer as its second argument. The second argument should be the subscript of a row in the array.The method should return the highest of the values in the specified row In the form of an (float). */ public static float getlowestInRow(float [][] testTwo) { /* Store the first value in the testOne array in the variable highest. */ float highest = testTwo[0][0]; highest = 0; // Set the highest to 0. for (int row = 0; row < testTwo.length; row++ ) { for (int col = 0; col < testTwo.length ; col++) if (testTwo[row][col] > highest) highest = testTwo[row][col]; } // Return the highest value. return highest; } /* The getlowestInRow method should accept a two-dimensional array as its first argument and and integer as its second argument. The second argument should be the subscript of a row in the array.The method should return the highest of the values in the specified row In the form of an (double). */ public static double getlowestInRow(double [][] testThree) { /* Store the first value in the testOne array in the variable highest. */ double highest = testThree[0][0]; highest = 0; // Set the highest to 0. for (int row = 0; row < testThree.length; row++ ) { for (int col = 0; col < testThree.length ; col++) if (testThree[row][col] > highest) highest = testThree[row][col]; } // Return the highest value. return highest; } /* The getlowestInRow method should accept a two-dimensional array as its first argument and and integer as its second argument. The second argument should be the subscript of a row in the array.The method should return the highest of the values in the specified row In the form of an (long). */ public static long getlowestInRow(long [][] testFour) { /* Store the first value in the testOne array in the variable highest. */ long highest = testFour[0][0]; highest = 0; // Set the highest to 0. for (int row = 0; row < testFour.length; row++ ) { for (int col = 0; col < testFour.length ; col++) if (testFour[row][col] > highest) highest = testFour[row][col]; } // Return the highest value. return highest; } // ============ End of the getHighest method. ========== }

**This my 2DArrayOperationsDemo code**

public class TwoDArrayOperationsDemo { public static void main(String[] args) { /* Four different kinds of arrays with four different data types. */ // First array named testOne. int[][] testOne = {{1, 2, 3, 4, 5, 6, 7, 8, 9 , 10}}; // Second array named testTwo. float[][] testTwo = {{11, 12, 13, 14, 15, 16, 17, 18, 19, 20 }}; // Third array named testThree. double[][] testThree = {{2.1, 2.2, 2.3, 2.4, 2.5, 2.6, 2.7, 2.9, 3.0, 3.1, 3.2, 3.3 }}; long[][] testFour = {{34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53}}; // Display the first array information: System.out.print("The following information is " + "for the testOne array:" + "\n" ); System.out.println("The total is " + TwoDArrayOperations.getTotal(testOne)); System.out.println("The average is " + TwoDArrayOperations.getAverage(testOne)); System.out.println("The row total is " + TwoDArrayOperations.getRowTotal(testOne)); System.out.println("The column total is " + TwoDArrayOperations.getColumnTotal(testOne)); System.out.println("The heightest is " + TwoDArrayOperations.getHigestInRow(testOne)); System.out.println("The lowest is " + TwoDArrayOperations.getlowestInRow(testOne)); System.out.println(); // Display the second array information: System.out.print("The following information is " + "for the testTwo array:" + "\n" ); System.out.println("The total is " + TwoDArrayOperations.getTotal(testTwo )); System.out.println("The average is " + TwoDArrayOperations.getAverage(testTwo )); System.out.println("The row total is " + TwoDArrayOperations.getRowTotal(testTwo )); System.out.println("The column total is " + TwoDArrayOperations.getColumnTotal(testTwo )); System.out.println("The heightest is " + TwoDArrayOperations.getHigestInRow(testTwo )); System.out.println("The lowest is " + TwoDArrayOperations.getlowestInRow(testTwo )); System.out.println(); // Display the third array information: System.out.print("The following information is " + "for the testThree array:" + "\n" ); System.out.println("The total is " + TwoDArrayOperations.getTotal(testThree)); System.out.println("The average is " + TwoDArrayOperations.getAverage(testThree)); System.out.println("The row total is " + TwoDArrayOperations.getRowTotal(testThree)); System.out.println("The column total is " + TwoDArrayOperations.getColumnTotal(testThree)); System.out.println("The heightest is "+ TwoDArrayOperations.getHigestInRow(testThree)); System.out.println("The lowest is " + TwoDArrayOperations.getlowestInRow(testThree)); System.out.println(); // Display the fourth array information: System.out.print("The following information is " + "for the testFour array:" + "\n" ); System.out.println("The total is " + TwoDArrayOperations.getTotal(testFour)); System.out.println("The average is " + TwoDArrayOperations.getAverage(testFour)); System.out.println("The row total is " + TwoDArrayOperations.getRowTotal(testFour)); System.out.println("The column total is " + TwoDArrayOperations.getColumnTotal(testFour)); System.out.println("The heightest is "+ TwoDArrayOperations.getHigestInRow(testFour)); System.out.println("The lowest is " + TwoDArrayOperations.getlowestInRow(testFour)); System.out.println(); } }

The code complies just find. the problem I'm having is that when I interpreter it gives the following

---------- java interpreter ----------

The following information is for the testOne array:

The total is 55

Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 1

at TwoDArrayOperations.getAverage(TwoDArrayOperations.java:151)

at TwoDArrayOperationsDemo.main(TwoDArrayOperationsDemo.java:38)

Output completed (0 sec consumed) - Normal Termination

**What does this mean and how can fix it?**

Thank you in advanced!!!!