Starting from:
$35

$29

Computer Science Project 2 Solution

General Description:  You are to write a program that asks the user for a choice of pattern, and then a choice of size.  It will produce, on the screen, a square with the particular pattern of the given size (see examples on separate sheet.)

Details:
    1. The program will keep repeating until the user chooses to quit

    2. There are 4 patterns to choose from: (again, see examples)
            i. a square with a left to right diagonal in which the diagonal is the size of the square
            ii. a square with a right to left diagonal in which the diagonal is the size of the square
            iii. a square that fills from left to right, using the size of the square as the ‘fill’ character
            iv. a square that fills from right to left, using the size of the square as the ‘fill’ character
If the user tries to make an invalid choice, the program should keep asking for a valid choice

    3. There are 9 sizes to choose from: 1 – 9 
If the user enters an invalid size, the program should keep asking until a valid size is entered

    4. You MUST use a switch statement in your code for the pattern choice.

    5. You MUST use a do-while loop to repeat the program for the user.

    6. You MAY use functions in your code if you know how, but they are not required.

    7. You must have internal documentation:
See the handout on Documentation Standards

    8. I do NOT want to see 36 different patterns hard-coded into the program!!
You should have one block of code for each pattern which produces the correct pattern and size.  

SAMPLE OUTPUT


c
SAMPLE OUTPUT WITH ‘INVALID’ INPUT

More products