CPSC 120 Postlab 8
Due before class on Monday, November 2, 2009

Write a program to print a diamond-shaped pattern of stars (asterisks). Your program should ask the user to enter the number of rows in the top part of the diamond, then print the diamond (which will consist of a triangle with the number of rows specified with a second "upside down" triangle with one less row). For example, if the user enters 6 for the number of rows the program should print:

            *
           * *
          * * *
         * * * *
        * * * * *
       * * * * * *
        * * * * *
         * * * *
          * * *
           * *
            *
HINTS: You will need several nested for loops similar to the nested loop in the Stars program on page 155 of the text. You will need to make adjustments to the loop control and other parts of the header in the for loop to get the right number of stars printed. Also note that you need to print some blank spaces before each row to "move" the stars over. Printing blank spaces is just like printing the asterisks - you need a loop. It would be a good idea to get the top half right then add the bottom part of the diamond.

Requirements: As usual you must use good programming style and document your program (including header documentation that describes what the program does and includes your name, documentation on the main method, and in-line documentation to mark the main sections of code). Your program should be in the lab8 package created in lab.

Submission: cp a tgz file (with your name as the file name) that contains the java file for your program to the directory:

   /home/staff/bouchard/CPSC120B/post8