Question: Provied a loop with a menu. Repeat until the user selects quit. Prompt the user to select one of the menu items. Test for numbers

Provied a loop with a menu. Repeat until the user selects quit. Prompt the user to select one of the menu items. Test for numbers that are not in the menu, provide an error message, and then continue. The menu shall contain:
1. Square   pattern
2. Triangle pattern
3. Diaginal pattern
4. Reverse diaginal pattern
5. Quit

After the user selects a pattern, allow them to specify the size. If the size is smaller than 1 or larger than 9, give them an error message and repeat the specification of the size.

Once the user has correctly selected a pattern and a size, print the pattern using the size specified.

Pattern 1 is a square. Example for size 4:

4444
4444
4444
4444

Pattern 2 is a triangle. Example for size 5:

5
55
555
5555
55555

Pattern 3 is a square with a diaginal of numbers in stars. Example for size 6:

6*****
*6****
**6***
***6**
****6*
*****6

Pattern 4 is a square with a reversed diaginal of numbers in stars. Example for size 7:

******7
*****7*
****7**
***7***
**7****
*7*****
7******

Step by Step Solution

3.53 Rating (163 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

Lets tackle this problem by outlining a solution incorporating ... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!