Create the above 2D array in Java. Make sure it has the identifier (variable name) dataSet
Write some code to display every value stored in the array.
tricky - can you make the output look like a table of data?
A function, count3s, takes a 2-dimensional integer array as a parameter. It returns a count of how many 3s are stored in the array. The function header is:
public static int count3s(int[][] nums)
Code this function and use this main program to test your design:
int[][] dataSet = {{3,2,2}, {1,2,3}, {1,5,6}, {4,3,3}};
int result = count3s(dataSet);
System.out.print(result);
A function, rowIndex, processes a 2D array. It returns the index of the row which has the greatest total. If more than 1 row has the greatest total, it will return only one of the indexes.
The function header is:
public static int rowIndex(int[][] nums)
Test your solution with this program:
int[][] dataSet = {{3,2,2}, {1,2,3}, {1,5,6}, {4,3,3}};
int result = rowIndex(dataSet);
System.out.print(result);