CMPS 134 Fall 2019
Programming Assignment #1: Drawing A Checkerboard
Due: 11:59pm, Sunday, September 8

Specification

+--------------------------------+
|****    ****    ****    ****    |
|****    ****    ****    ****    |
|****    ****    ****    ****    |
|    ****    ****    ****    ****|
|    ****    ****    ****    ****|
|    ****    ****    ****    ****|
|****    ****    ****    ****    |
|****    ****    ****    ****    |
|****    ****    ****    ****    |
|    ****    ****    ****    ****|
|    ****    ****    ****    ****|
|    ****    ****    ****    ****|
|****    ****    ****    ****    |
|****    ****    ****    ****    |
|****    ****    ****    ****    |
|    ****    ****    ****    ****|
|    ****    ****    ****    ****|
|    ****    ****    ****    ****|
|****    ****    ****    ****    |
|****    ****    ****    ****    |
|****    ****    ****    ****    |
|    ****    ****    ****    ****|
|    ****    ****    ****    ****|
|    ****    ****    ****    ****|
+--------------------------------+
For this assignment, you are to develop a Java program named DrawCheckerBoard that produces as output the figure shown to the right, which is a crude rendering of a standard 8×8 checkerboard.

Purpose

Here is a Java program that produces the correct output. Although it is nicely formatted (i.e., its code is indented properly, with blank lines separating logically distinct code segments) and includes appropriate comments, it is a poorly designed program. (You are encouraged to examine it now.)

Question: In what sense is it poorly designed?
Answer: It shows absolutely no evidence that the author/programmer employed the concepts of procedural decomposition, capturing structure, or eliminating redundancy that are presented in Sections 1.4 and 1.5 of our textbook (Building Java Programs, by Reges & Stepp). Indeed, the body of the method that actually "draws" the board is a sequence of 26 highly redundant System.out.println() statements, similar to the equally bad DrawFigures1 program in Section 1.2 of the textbook.

Your goal is to transform the given program into one that is well designed. As a model, follow the same train of thought that guided Reges and Stepp (see Sections 1.4 and 1.5) in reworking the DrawFigures1 program to obtain first DrawFigures2 and then finally DrawFigures3. (Links to all three of these Java programs appear on the course web page.)

In the end, your program should include several methods, each of which "draws" some part of the figure. Because there is much repetition within the figure, at least a few of your methods should be called multiple times during execution of the program. One such method might be called drawBWRow(), suggesting that its purpose is to "draw" a row of checkerboard squares whose leftmost square is black. Of course, there are four such rows on a checkerboard.

Note to students with prior programming experience: You are to pretend that you know nothing about variables or loops, neither of which are introduced before Chapter 2. Although using either one, or both, could improve the given program, that is not the intent of this assignment. Rather, concentrate upon employing the ideas of Sections 1.4 and 1.5, as indicated above.

Submitting Your Source Code

To submit your program, log into the Student File Submission System (see link near top of course web page) and then click on the link to the "prog1_dir" folder. In the text box, enter a title (e.g., "checkerboard"), then click on one of the "Browse" buttons, after which you can browse within your computer's secondary storage to find the file that you want to submit/upload, which is the file containing your DrawCheckerBoard Java source code. Its name must be DrawCheckerBoard.java. (Do not submit the associated .class file.)

After you click on the "SUBMIT FORM" button, you should get a message confirming that your file was submitted/uploaded. You can then click on the large "Continue" link at the top right of the page, which should take you back to the page from which you made the submission. Above the "Form to Submit Message ..." there should be a table that lists any files that you have submitted to the prog1_dir folder. To double-check that you submitted the intended file, click on the corresponding link to download the file into some application (e.g., jGrasp, WordPad) that allows you to examine it to verify that it is the correct file.

Note that you can submit more than one time to the same folder. Hence, if, after submitting, you improve your program (e.g., by fixing logic errors or by enhancing your comments), you should submit the newer version. Do not use a new file name every time you submit. Rather, use the same name each time. Within your submission folder, any previously submitted file having the same name will be renamed automatically (and still be accessible to both you and your instructor). Generally speaking, however, your instructor will probably examine only your most recent submission, unless you make a request to the contrary.

Make sure to include comments in your program identifying yourself, indicating that it is a solution to CMPS 134's Prog. Assg. #1, acknowledging any persons who aided you in developing your solution, and pointing out any flaws of which you are aware. (These comments should be placed just above the class heading; use this as a template.)