CMPS 134 Fall 2023
Programming Assignment #1: Drawing A Checkerboard
Due: 11:59pm, Friday, September 15

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.

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 of the textbook) 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, use the Brightspace dropbox for Programming Assignment #1. What you are to submit is the file containing your Java "source code", the name of which must be DrawCheckerBoard.java. (Do not submit the associated .class file.)

Note that you can submit more than one time to the same dropbox. 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.)