Refer to Program Challenge #16 found on page 493 of the text. Use the program sp
ID: 3574636 • Letter: R
Question
Refer to Program Challenge #16 found on page 493 of the text.
Use the program specifications as a basis for the project but include the following modifications:
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.
Develop the UML diagram for the class
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).
Explanation / Answer
input.txt
7 8
9 1 6
4 5 8
Sample Output:
Max value : 9
Min value : 6