Repeat Exercise P15.20, but use a queue instead.

Complete the following files:

FloodFillTester2.java

Grid.java

public class Grid { private static final int SIZE = 10; int[][] pixels = new int[SIZE][SIZE]; . . . /** Flood fill, starting with the given row and column. */ public void floodfill(int row, int column) { . . . } public String toString() { String r = ""; for (int i = 0; i < SIZE; i++) { for (int j = 0; j < SIZE; j++) r = r + String.format("%3d", pixels[i][j]); r = r + "\n"; } return r; } }

Pair.java

Use the following files:

FloodFillDemo.java

public class FloodFillDemo 
{
   public static void main(String[] args)
   {
      Grid gr = new Grid();
      gr.floodfill(3, 4);
      System.out.println(gr.toString());
   }
}

FloodFillTester.java

public class FloodFillTester
{
   public static void main(String[] args)
   {
      Grid gr = new Grid();
      gr.floodfill(3, 4);
      String[] rows = gr.toString().split("\n");
      System.out.println(rows[2]);
      System.out.println("Expected:  46 31 18  8  2  7 17 30 45 61");
      System.out.println(rows[3]);
      System.out.println("Expected:  40 25 13  5  1  3  9 19 32 47");
      System.out.println(rows[4]);
      System.out.println("Expected:  56 39 24 12  4 10 20 33 48 62");
   }
}