
write a java program that can create four different patterns of different sizes. The size of each pattern is determined by the number of columns or rows. For example, a pattern of size 5 has 5 columns and 5 rows. Each pattern is made of character $ and a digit, which shows the size. The size must be between 2 and 9. The following shows the four pattern in size 5.
Pattern 1 5$$$$ $5$$$ $$5$$ $$$5$ $$$$5
Pattern 2 $$$$5 $$$5$ $$5$$ $5$$$ 5$$$$
Pattern 3
$$$$$ $$$$5 $$$55 $$555 $5555
Pattern 4
$$$$$ 5$$$$ 55$$$ 555$$ 5555$
Your program displays a menu and asks the user to choose a pattern and size. But note that it must prompt the user to choose an option only between 1 and 5 and a pattern size only between 2 and 9. You are print the menu and the user's response. The following example shows all user menu responses, including potential errors:
Menu
Enter option (1 to 5) : 11 Option incorrect. Try again. Enter option (1 to 5) : 3 Enter pattern size (2 to 9) : 12 Pattern size incorrect. Try again. Enter pattern Size (2 to 9): 4
The program must consists of one main function and six other functions called getOption, getSize, patternOne, patternTwo, patternThree, and patternFour.
Run your program once with the options and sizes shown in Table 6-7. Note that some options and sizes are missing because either the previous option or the size is invalid.
Option Size
Set 1 1 2
Set 2 2 3
Set 3 3 4
Set 4 4 5
Set 5 6 6
Set 5 3
Set 6 2 10
Set 6 7
Set 7 5
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.