Question: In Java. You will write a program that will sort the columns in a 2D array. The number of rows, number of columns and the
In Java.

You will write a program that will sort the columns in a 2D array. The number of rows, number of columns and the maximum possible value will be obtained via command line parameters (in the listed order). Remember, you will have to convert the rows, cols and maximum value from String to int. Implement the following methods: public void createData( String filename, int numRows, int numCols, int maxValue) This method should create a file with numRows rows of integer values. Each row will contain numCols values on it separated by a space (i.e. The input file will match the dimensions of the 2D array.). public void readData( String filename, int [][]matrix) Read the integer values from the file into the 2D array. Assumes that the array has already been instantiated. public void sortColumn( int [][] matrix, int col ) Sort the column col of the matrix using Selection Sort. public void sortMatrix ( int [][] matrix ) Sort each column in the 2D array by calling sortColumn for each column in the array. public void sortMatrix ( int [][] matrix ) Print the contents of the 2D array with each row on a separate line and each column separated by space(s). Create a main method that will use the above methods to generate the file of random values, read the data from the file into the 2D array, output the unsorted array to the console, sort the array columns and the output the sorted array to the console
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
