Answered step by step
Verified Expert Solution
Question
1 Approved Answer
CODE: public class TestGenericSorting { public static void main(String[] args) { Integer[][] grid = {{32, 19, 27, 90}, {100, 22, 29, 23}, {34, 1, 45,
CODE:
public class TestGenericSorting
{
public static void main(String[] args)
{
Integer[][] grid = {{32, 19, 27, 90},
{100, 22, 29, 23},
{34, 1, 45, 37},
{397, 49, 76, 63},
{204, 95, 77, 49},
{47, 54, 13, 11}};
Double[][] grid2 = {{1.9, 3.4, 0.45 , 23.9, 34.5},
{1.49, 6.37, 7.54, 5.43, 3.46},
{50.76, 112.24, 19.6, 19.99, 45.3}};
Integer[][] grid3 = {{95, 34, 87, 300, 899, 6},
{99, 32, 777, 900, 87, 4},
{3, 9, 430, 235, 102, 32},
{45, 34, 98, 23, 190, 19},
{93, 54, 86, 84 ,27, 19},
{234, 54, 67, 20, 200, 123},
{30, 7, 19, 22, 34, 31}};
GenericSorting srt = new GenericSorting(grid);
srt.sortAsc();
srt.print2DArray();
System.out.println();
srt.setGrid(grid2);
srt.sortDes();
srt.print2DArray();
System.out.println();
srt.setGrid(grid3);
srt.sortAsc();
srt.print2DArray();
System.out.println();
/*
GenericSorting srtFile = new GenericSorting("src/project1/data.txt");
srtFile.sortAsc();
srtFile.print2DArray();
*/
}
}
DATA.txt
500 3 9 7
11 2 14 10
25 1 19 15
342 21 16 29
204 54 23 43
42 27 15 11
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started