/**
 * CS139 - Programming Fundamentals
 * Department of Computer Science
 * James Madison University
 * @version Spring 2016
 */

Objectives

Instructions

  1. Download Stars.java and open it in jGRASP.

  2. Write your name and today's date in the class comment.

  3. Compile and run the program. What shape does this pattern produce?

  4. Notice the relationship between the row (outer loop) and the number of stars that are printed.

  5. Complete the unfinished methods to create Patterns A, B, and C as shown below.

Pattern A

**********
*********
********
*******
******
*****
****
***
**
*

Test your code with an odd number of stars and an even number of stars.

Pattern B

         *
        **
       ***
      ****
     *****
    ******
   *******
  ********
 *********
**********

HINT: While developing the code, replace each space with another character that is visible.

HINT: You used starCount in the original example and Pattern A. You should think about using the spaceCount variable here.

Pattern C

**********
 *********
  ********
   *******
    ******
     *****
      ****
       ***
        **
         *

HINT: It should be the same as Pattern B, except for the way you calculate spaceCount and starCount.

Submit Stars.java via Web-CAT. Checkstyle will not be run on your submission.

Pattern D  (If you have time.)

    *
   ***
  *****
 *******
*********
*********
 *******
  *****
   ***
    *

For an odd number of rows, you would only have one middle line. The middle row leftmost star is in the first position of the output.

HINT: Consider writing two loops: one for the top half, and another for the bottom half. You may also want to increment and decrement starCount and spaceCount, rather than calculate them directly based on the row number.