Question: Write a program to display a shape using star (*) based on the user selection. The program will repeatedly ask the user to determine the

Write a program to display a shape using star (*) based on the user selection. The program will repeatedly ask the user to determine the shape number (any number from 1-6, see below) and its parameters (i.e. width, height). The program will stop asking the user for more inputs only when the user inputs 7 (which means exit). The user will see the following menu: 1: Square 2: Rectangle 3: Left Lower Triangle 4: Right Lower Triangle 5: Left Upper Triangle 6: Right Upper Triangle 7: Exit Enter the number of the shape you want to be drawn on the screen: - In case the user selected 1, you will ask the user to enter the length of the square, and your program will then call a function that will draw the square based on the given length. - In case the user selected 2, you will ask the user to enter the width and the height of the rectangle, and your program will then call a function that will draw the rectangle based on the given width and height - In case the user selected 3 or 4 or 5 or 6, you will ask the user to enter the length of the triangle. In your code you will write 4 functions to draw the corresponding 4 triangle types based on the given length. For example, given a length=5 o Left Lower Triangle function will draw: * * * * * * * * * * * * * * * o Right Lower Triangle will draw: * * * * * * * * * * * * * * * o Left Upper Triangle will draw: * * * * * * * * * * * * * * * o Right Upper Triangle will draw: * * * * * * * * * * * * * * * - In case the user selected 7, your program should stop running - In case the user selected a number not in the range (1-7), your program will print a message invalid selection, try again, and the menu should be displayed again. - After a user select any of the number 1-6, and after drawing the required shape, the menu should be displayed again asking the user for a new selection

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock 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 General Management Questions!