• Program is adequately documented. It's comments identifies its name, purpose, author and date.

Throughout the code, comments and/or relevant component names should attempt to make the

program understandable.

• Code carefully addresses each task in the assignment.

• The program compiles without error and pertains to the assignment.

Tasks

Use loops and conditions in Java to produce shapes out of Unicode characters. The program's user

menu affects a switch-statement, which in turn affects the program's action. A menu is displayed which

asks a user to select a shape:

1 triangle

2 square

3 diamond

The program then asks the user to enter any character with which to fill the shape, such as *, or enter

nothing for the program's default character set. This default entails filling the shape with the characters

of the alphabet according to their sequential Unicode decimal value (see http://unicodelookup.com ).

Therefore, the number of characters in each shape should at least accommodate the entire alphabet. For

example, a square might look like:

A B C D E F

G H I J K L

M N O P Q R

S T U V W X

Y Z a b c d

e f g h I j

Your program must draw these shapes iteratively and use at least each of the following loop types at

least once: for, while, do while.

You do not get to use Swing's pre-built shape methods. For output in applet form, you must adjust the

coordinates in g.drawString(“ ”, x, y) with each loop iteration. You may alternatively submit the

program in non-applet (command-line) form, which I recommend.

5% extra credit: Add the choice of a circle to your completed shape generating program.

    • 11 years ago
    Java Shape Program Console
    NOT RATED

    Purchase the answer to view it

    blurred-text
    • attachment
      main.zip
    • attachment
      1.jpg
    • attachment
      2_2.jpg
    • attachment
      3.jpg