Question: Write an interactive program where two distinct rectangular shapes using the character 'X' maybe displayed on the screen given user input of (a) two positive
Write an interactive program where two distinct rectangular shapes using the character 'X' maybe displayed on the screen given user input of (a) two positive integers between 5 and 12 and (b) the users choice of "rectangular" display type.
The two integer values (between 5 and 12) should be used to represent no# of columns (or width) and no# of rows (or height) to generate the respective shapes on the screen. If the numbers are different, the larger of the two numbers should be used for the height (ie, rows) and the smaller for the width (ie, columns). The user should have an opportunity to choose between the two shapes to be displayed and when to quit the program.
Using appropriate control structures (HINT! nested while loops or for statements)write the necessary program statements that will display the desired shapes.
For example, if the user enters two positive integers 7 and 5 and selects 1:RECTANGLE - OUTLINE FORMAT the program should display the following:
XXXXX X X X X X X X X X X XXXXX
On the other hand if perhaps the user chooses 2: RECTANGLE - FILLED-IN FORMAT the program should display the following:
XXXXX XXXXX XXXXX XXXXX XXXXX XXXXX XXXXX
No setw implementation is allowed here but you must use nested loop or for statements with proper indentation to generate these patterns. Use meaningful variable identifier names, good prompting messages and appropriate comments for each loop segment as well as other sections in the body of your program.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
