Lab 8: Stars 3 (Optional)

Goals: To write lots of loops, nested and otherwise

What to do: Write a Java application that will read in from the user the width of the picture they want and the character they would like to use. The user may just press enter when prompted for the character and get the default character (which is an asterisk).

Sample Output:

Please enter the width of the diamond: 9
Please enter the character to use: #

    #
   ###
  #####
 #######
#########
 #######
  #####
   ###
    #

Note: The width needs to be odd. If the user enters an even number, add 1 to it.

Note: The left edge of the diamond needs to touch the left edge of the screen.

What to submit: Show me your program when completed.

© Daubenmier/Ehrenfried 2005
Comments