Due: 2:00 PM, Monday, 10/18/10
This assignment is to implement a simple command line interface. That is, it allows the user to enter a series of commands to control execution of a program and shows the user the results of each command.
This program should still follow the structure of Program 5: it should have classes TestCheckers, Game, Checkers, Board, and BadRowOrColumnNumberException and interface Moves that satisfy the design requirements (class structure, methods, and packaging) specified in Program 5.
The program should have a class named TestCheckers which contains the main method.
This time the main() method needs to manage only a single game.
The main() method should accept commands from the command line, one command per
line. Commands are of the form
command parameter1 parameter2 ....
All commands are free-format, i.e., variable spacing before
and after commands and parameters, and not case-sensitive.
That means the command can be typed in upper or lower case characters, or a
mixture of both.
As each command is read, it is echoed to the screen. That is, it is printed on the screen exactly as it was entered. Then it is reprinted in a standard format described below.
The commands are:
> start
start
START
> Move 5 1 7 4
move 5 1 7 4
MOVE 5 1 7 4
> moove 34 14
moove 34 14
Illegal command
> placE 4 2 6
placE 4 2 6
PLACE 4 2 6
> place 5 -8 2
place 5 -8 2
Illegal parameter: -8
>quit
quit
QUIT
It is not necessary to use additional exception handling in this program, but you may want
to.
All exceptions should be detected and thrown in the method where they occur,
and caught in main(). This will include I/O exceptions and exceptions caused by bad
parameter values. You don't need to consider illegal checkers moves (unless you want to).
All exception classes that you define should contain variables and methods that enable
main() to extract important information about the exception, so that main() can respond
appropriately to each exception.
Your grade will be based on how well you design and implement the code, how thorough your error handling is, on good programming practices, and on thorough testing. Coding guidelines for Java programs are posted here.
Add comment documentation to your program 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).
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.
Within this individual directory, create a subdirectory named p6. Copy only the source files into this directory, not class files or javadoc files. So, for example, if your login name was smithjd then the files TestCheckers.java, Game.java, Board.java, Checkers.java, Moves.java, BadRowOrColumnNumberException.java, and any other java source files you wrote should be copied to /afs/cu/class/cs242/fa10/smithjd/p6. These directories have permissions set so that no one other than yourself and Prof. Lynch can read the files. You may, of course, use whatever operating system and compiler you wish to develop your code, but the version you turn in, both hardcopy and the files submitted to AFS, must compile and run under JDK installed in the Clarkson ITL (our lab room).