Lab 8: Post-Lab Assignment

Due by class Monday November 7th

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 148 of the text. Note that in the above diamond there is a blank space inbetween each star. 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).

Other Requirements

Submission

To submit your code, create a zip file named YourLastName.zip and upload the zip file to the course Inquire site.