public class Data
{
public static final int MAX = 100;
private int[][] grid;
public Data()
{
grid = new int[3][9];
}
public void repopulate()
{
//add code for part A
}
public int countIncreasingCols()
{
return 0; // Statement add to compile. Delete when writing your answer
//add code for part B
}
public String toString()
{
String s = "";
for(int i = 0; i < grid.length; i++)
{
for( int j = 0; j < grid[i].length; j++ )
s = s + grid[i][j] + " ";
s += "\n";
}
return s;
}
}
|
Use this Java program to test your answer to question:
public class Test
{
public static void main(String[] args)
{
Data x = new Data();
System.out.println( x );
x.repopulate();
System.out.println( x );
System.out.println(x.countIncreasingCols());
}
}
|
The correct answer will be something that looks like this:
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 70 80 60 30 10 30 50 30 90 80 60 20 30 10 40 90 30 40 50 90 10 70 20 80 60 40 30 4 |
You need to verify the number of increasing columns. (I did that in red)