Description
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:
- The program will keep repeating until the user chooses to quit
- There are 4 patterns to choose from: (again, see examples)
-
- a square with a left to right diagonal in which the diagonal is the size of the square
- a square with a right to left diagonal in which the diagonal is the size of the square
- a square that fills from left to right, using the size of the square as the ‘fill’ character
- 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
- 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
- You MUST use a switch statement in your code for the pattern choice.
- You MUST use a do-while loop to repeat the program for the user.
- You MAY use functions in your code if you know how, but they are not required.
- You must have internal documentation:
See the handout on Documentation Standards
- 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
SAMPLE OUTPUT WITH ‘INVALID’ INPUT