question archive Write program that has the class name Problem2 and that has the main method
Subject:Computer SciencePrice: Bought3
Write program that has the class name Problem2 and that has the main method. Leave the main method empties for now. • Write method named transpose that takes one parameter, a 2-dimensional (2D) integer array named a and returns a new 2D integer array. • The method should create new array a making the first column of a be the first row of the new array, the second column of a be the second row of the new array, and so on. See sample usage below. • Create printArray method that takes a 2D integer array as a parameter and prints out the elements of each row on its own line separated by spaces. • Several sample usages are provided for you below. Use the sample usages in the main method to test your code (and use the printArray method to print out the results of calling the transpose method!).
Sample Method Usage Return
int [] [] a = {{3, -2, 18}, {14, 0, 9}};
int [] [] a1 = transpose(a);
{{3, 14}, { -2, 0}, {18, 9}};
int [] [] b = {{5, 8}, {6, 6}, { -1, -2}};
int [] [] b1 = transpose(b);
{{5, 6, 0, -1}, {8, 6, 4, -2} }; {0, 4},