CMPS 134 Fall 2019
Programming Assignment #3: Drawing a Variable Size Checkerboard
Due: 11:59pm, Sunday, September 29

Specification

In your first programming assignment, you were to develop a Java program that "drew" a crude 8×8 checkerboard in which each square had height three and width four. For this assignment, you are to modify a given program that does exactly that to obtain a program that is capable of "drawing" a checkerboard whose size (i.e., number of rows, number of columns, height and width of each square) is determined by inputs entered by the user. The key to accomplishing this is to use methods with parameters.

You are given the Java application DrawVarSizeCheckerBoard. As given, it prompts the user to enter four inputs (# of rows, # of columns, height and width of each square) and reads them (using a Scanner object), but then it ignores those inputs and "draws" a checkerboard identical to that prescribed by Prog. Assg. #1.

You are to modify the program so that the checkerboard that it draws is consistent with the inputs entered by the user. This is to be accomplished by "parameterizing" many of the program's methods. To aid you in doing this, new method headings have been included (as comments) immediately above the old ones. Each new method heading includes declarations of formal parameters that are needed by the method to carry out its task. Thus, in your solution, every such new method heading should have replaced the old (parameter-less) heading.

Of course, the body of any method whose heading is to be replaced must be modified. In particular, a method's body should refer to each of the method's formal parameters. (After all, any parameter that is not mentioned in a method's body must not be relevant to the task carried out by that method and hence should not be among the parameters that the method receives.)

Included in the given program are declarations of several class constants that are intended to determine which characters are used in drawing the board. However, none of the methods refer to any of these class constants; instead, they use character literals. It is expected that your solution will make appropriate use of the declared class constants.


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 "prog3_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 DrawVarSizeCheckerBoard Java source code. Its name must be DrawVarSizeCheckerBoard.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 prog3_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. #3, acknowledging any persons who aided you in developing your solution, and pointing out any flaws of which you are aware.