Question: a program that creates a two-dimensional array initialized with test data. Use any primitive data type that you wish. The program should have the following

a program that creates a two-dimensional array initialized with test data. Use any primitive data type that you wish. The program should have the following methods: getTotal. This method should accept a two-dimensional array as its argument and return the total of all the values in the array. getAverage. This method should accept a two-dimensional array as its argument and return the average of all the values in the array. getRowTotal. This method should accept a two-dimensional array as its first argument and an 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. getColumnTotal. This method should accept a two-dimensional array as its first argument and an 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 column. getHighestInRow. This method should accept a two-dimensional array as its first argument and an integer as its second argument. The second argument should be the subscript of a row in the array. The method should return the highest value in the specified row of the array. getLowestInRow. This method should accept a two-dimensional array as its first argument and an integer as its second argument. The second argument should be the subscript of a row in the array. The method should return the lowest value in the specified row of the array. Demonstrate each of the methods in this program. Create a concrete class named TwoDimArray. Define the backing 2D array as an instance variable and use the integer primitive type. Declare any other instance variables required to implement the class. Implement instance methods as outlined in the program specification and add the following methods:getArrayMaxValue(), getArrayMinValue(), and loadArray(). Use a JOptionPane to prompt the user for an input file name. If the file doesn't exist or is empty, display an error message using a JOptionPane and quit. Use try-catch blocks to trap and handle exceptions. Use the loadArray instance method to read the data from a file where the first record (line) contains two numbers: the first represents the number of rows and the second number represents the number of columns. If there is an error reading the file or if the row/column data is invalid, display an error message using a JOptionPane and quit. Subsequent records in the file will represent the array data. If there is an error reading the file or if the data is invalid or missing, display an error message using a JOptionPane and quit. Use try-catch blocks. Include Javadoc documentation at the class and method levels. When finished, run the source code through the Javadoc utility to create the HTML version of the TwoDimArray class API. Include a public static void main(String[]) method in the class and use it as a driver module to create an instance of the class and to test the various instance methods. Use System.out.println() to display all normal program output (send it to the standard output device).

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!