CMPS 134 Fall 2024
Programming Assignment #1: Drawing A Football Field
Due: 11:59pm, Monday, September 9

Specification

+-----------------------+
|#######################|
|#######################|
+-----------------------+
|                       |
|                       |
+-------+-------+-------+
|                       |
|                       |
+-------+-------+-------+
|                       |
|                       |
+-------+-------+-------+
|                       |
|                       |
+-------+-------+-------+
|                       |
|                       |
+=======+=======+=======+
|                       |
|                       |
+-------+-------+-------+
|                       |
|                       |
+-------+-------+-------+
|                       |
|                       |
+-------+-------+-------+
|                       |
|                       |
+-------+-------+-------+
|                       |
|                       |
+-----------------------+
|#######################|
|#######################|
+-----------------------+
For this assignment, you are to develop a Java program named FootballField that produces as output the figure shown to the right, which is a crude rendering of an American football field.

Purpose

Provided to you is FootballFieldPoor, 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 (namely, procedural decomposition, capturing structure, and eliminating redundancy) presented in Sections 1.4 and 1.5 of our textbook (Building Java Programs, by Reges & Stepp). Indeed, the program consists of only a main() method containing 30+ System.out.println() statements, similar to the equally bad DrawFigures1 program in Section 1.2 of the textbook (and accessible via the course web page).

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 in reworking the DrawFigures1 program to obtain first DrawFigures2 and then finally DrawFigures3. (Again, see Sections 1.4 and 1.5.)

In the end, your program should include several methods, each of which "draws" some part of the field. Because there is much repetition within the figure, a few —and maybe even several— of your methods should be called multiple times during execution of the program. (One such method might be drawEndZone(), as there are two end zones. Another might be drawLineWithHashMarks(), as there are eight identical lines with hash marks on the field.)

Submitting Your Source Code

Submit your source code file (the name of which must be FootballField.java) to the appropriate dropbox in Brightspace. Do not submit the .class file.) 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 the program given to you as a template.)

Be aware that you can submit more than one time. Hence, if, after submitting, you improve your program (e.g., by fixing logic errors or removing more redundancy), you should submit the newer version. Do not use a new file name every time you submit. Rather, use the same name each time: FootballField.java. Generally speaking, only your last submission will be examined by your instructor. Hence, if you wish him to view earlier submissions, too, you need to specifically ask.