CS242: Advanced Programming Concepts in JAVA

Fall 2008

Program 3

Due: 10:00 AM, Monday, 9/15/08

This is a continuation of Program 2.

(a) Following the examples in class, the reading assignments, and the Java Tutorials, create a "Board" class which models a standard checker or chess board. This should be in a source file named Board.java, and your class must satisfy the interface given below; that is, you are not free to change the name, type, or behavior of the given methods. In addition, create a "TestBoard" class in a file named TestBoard.java which contains a main method that will test your Board class. For now your classes should be in the default package.

The gameboard is still the same as the one in Program 2. That is, it has the same dimensions, and only keeps track of which squares are empty or occupied.

Your grade will be based on how well you design and implement the code, on good programming practices, and on thorough testing. Coding guidelines for Java programs are posted here.

Class Board represents a standard checker or chess board.
Board
Board()
Board(String[] occupied)
void remove(int row, int col)
void place(int row, int col)
int show(int row, int col)
void display()

You should decide how your program handles bad moves, like trying to remove a piece from a square that is empty. For this kind of error, the program should not change the board, and it could give a warning and then continue.

(b) Add comment documentation to your program (both class Board and class TestBoard) and use javadoc to extract the documentation into an HTML file. Include a javadoc comment for each class and each method. The class comment should include your name and the date (use the @author tag). Method comments should briefly describe the purpose of the method, its arguments, and what, if anything, it returns (using @param and @return as appropriate). Although these are small classes now, and this may seem like a lot of commenting, we will expand on this assignment at a later date.

The physical location of the javadoc comments is critical. A class comment must immediately precede the line containing the keyword class, and method comments must immediately precede the method.

When you have commented your source files, run javadoc to create the .html files and view them in a browser of your choice.


What to submit:
Your grade on the program will be based on: