Computer Science 121
Assignment 6
Due: March 28, 2001

For this assignment, create an applet that will draw a checkerboard pattern on the screen. An example appears below. Replace the CircularFigure class in Assignment 5 with a SquareFigure class. Alternate colors so that the tile pattern can be seen.

The DrawABox application on the website gives an example of how to use a double for loop, with one loop nested within the other, in order to draw the pattern. Note also that you have to have an if-else statement so that the colors in the rows are alternated.

You may decide how large to make each square and what colors to use, but the side should probably be at least 20 pixels.

Make sure that your disk has the necessary class files as well as an html file called squares.html. That way it will be easy to find the correct file to load and check.

On a separate sheet, answer the following questions:

1. How did you decide upon the colors and sizes of the squares?

2. How did you set up the for loops in order to get the checkerboard design?

3. Did you have any problems with getting the colors to alternate?

4. How did you arrange to have each row begin with a different color?