CS 12300 - Programming Assignment 3

This assignment is due Friday, September 21.

This assignment makes use of the files contained in this zip file. This assignment is based on Sections 2.3 and 2.4 from the textbook.

In the zip file there is an incomplete program called Hw3.java. Complete the program so that it uses nested for-loops and class constants to draw pictures like these.

\     |\     |\     |
 \    | \    | \    |
  \   |  \   |  \   |
   \  |   \  |   \  |
    \ |    \ |    \ |
     \|     \|     \|
\       |\       |\       |\       |\       |
 \      | \      | \      | \      | \      |
  \     |  \     |  \     |  \     |  \     |
   \    |   \    |   \    |   \    |   \    |
    \   |    \   |    \   |    \   |    \   |
     \  |     \  |     \  |     \  |     \  |
      \ |      \ |      \ |      \ |      \ |
       \|       \|       \|       \|       \|
\   |\   |\   |\   |\   |\   |\   |\   |\   |\   |\   |\   |\   |\   |
 \  | \  | \  | \  | \  | \  | \  | \  | \  | \  | \  | \  | \  | \  |
  \ |  \ |  \ |  \ |  \ |  \ |  \ |  \ |  \ |  \ |  \ |  \ |  \ |  \ |
   \|   \|   \|   \|   \|   \|   \|   \|   \|   \|   \|   \|   \|   \|

The file Hw3.java contains the following two lines of code that define two class constants (see pages 108-110 of the textbook).

   public static final int HEIGHT = 6;
   public static final int WIDTH = 3;

Your code should use these two constants to determine the "dimensions" of the picture that it draws (the first picture above has dimensions HEIGHT=6 and WIDTH=3, the second picture has HEIGHT=8 and WIDTH=5, the third picture has HEIGHT=4 and WIDTH=14).

Make sure you test your program with several different values for the two class constants, but do not change their names. When I test your program, I will test it by changing the values of the two class constants. My testing program needs your two class constants to have exactly the names used in Hw3.java.

Be sure to study the programs in Examples-for-Sections_2.3-2.4.zip. They give you several examples of using a class constant to "scale" a picture.

Turn in a zip file called CS123Hw3Surname.zip (where Surname is your last name) containing your version of Hw3.java.

This assignment is due Friday, September 21.