Assignment 5, CS 46A
30 points
due October 8, 2003

Define a class Checkerboard with constructor and draw method as described below.

The constructor is to take three int arguments representing the location and size of the checkerboard in pixels. Specifically, the first parameter is to represent the location of the top of the checkerboard, and the second parameter is to represent the location of the left side of the checkerboard. The constructor should prompt the user for, and obtain, information about the first of the two colors to be used for the checkerboard. Specifically, it should obtain the values of the red, green, and blue components of this color from the user. The second color is to be obtained by complementing each of these three values, where "complementing" means subtracting from 1.0.

The draw method is to take a Graphics2D object as parameter, and draw the checkerboard on this object. There should be 8 rows and 8 columns of squares in the checkerboard, with each of the 4 squares adjacent to a given square having the opposite color from the given square.

For this assignment, the size of the checkerboard means the combined size of all 64 squares, rather than the size of a single square as in Assignment 4.

As in Assignment 4, it will be helpful to define one or more private methods that the public methods may invoke.

For this assignment, you should provide a copy of your code on diskette or CD (no email), and a hard copy of your code. You won't be able to provide a hard copy of the results of your testing. Of course you should test your code anyway, using the CheckerboardApplet class and the Checkerboard.html web page, both of which are available on the class web site.

It's ok if your constructor doesn't do any error handling, as long as you document this feature appropriately. Don't forget to document your algorithm for drawing, including its use of any auxiliary methods. You should know which comments are appropriate for Javadoc and which are not, but you will not be judged harshly on the syntax of your Javadoc comments.