Question: Program PrintTriangles.java prints out triangles and diamonds according to the user input. It first prints out a menu requesting the user to indicate which shape

 Program PrintTriangles.java prints out triangles and diamonds according to the userinput. It first prints out a menu requesting the user to indicatewhich shape the user wants. The user then inputs the size. Boththe shape choice and the size have to be within the limitset by the program. If the user input is not correct, user

Program PrintTriangles.java prints out triangles and diamonds according to the user input. It first prints out a menu requesting the user to indicate which shape the user wants. The user then inputs the size. Both the shape choice and the size have to be within the limit set by the program. If the user input is not correct, user is required to input again. The following demonstrates what the program does in details (Those in [] are comments to explain the output. You do not have to print them out in your program). The output samples are also available in electronic format.- Output 14 This program prints a shape with a certain size of your choice. You have to select the shape from one of the following: 0 -- right-angled triangle with the right angle in the lower left 1 -- right-angled triangle with the right angle in the upper left 2 -- right-angled triangle with the right angle in the lower right 3 -- a diamond After selecting the shape, you will be asked to input the size of the shape. For triangles, the size is the width and height of the triangle. This size must not be larger than 15. For diamonds, the size tells the number of * on the longest row. The size must be an odd number not larger than 15.4 Enter the choice of your shape:4 [user input 4 is not valid, ask again] Enter the choice of your shape:-1 [user input -1 is not valid, ask again] Enter the choice of your shape:0 [user input 0 is valid, ask size] Enter the size of your shape:16 [user input 16 is not valid, ask again] Enter the size of your shape:4 [user input 4 is valid, print shape] **e *** **** Output 24 This program prints a shape with a certain size of your choice. You have to select the shape from one of the following: 0 -- right-angled triangle with the right angle in the lower left 1 -- right-angled triangle with the right angle in the upper left 2 -- right-angled triangle with the right angle in the lower right 3 -- a diamond After selecting the shape, you will be asked to input the size of the shape. For triangles, the size is the width and height of the triangle. This size must not be larger than 15. For diamonds, the size tells the number of * on the longest row. The size must be an odd number not larger than 15.- Enter the choice of your shape:14 Enter the size of your shape:64 ******* ***** **** *** Output 3 This program prints a shape with a certain size of your choice. You have to select the shape from one of the following: 0 -- right-angled triangle with the right angle in the lower left 1 --right-angled triangle with the right angle in the upper left 2 -- right-angled triangle with the right angle in the lower right- 3 -- a diamond After selecting the shape, you will be asked to input the size of the shape. For triangles, the size is the width and height of the triangle. This size must not be larger than 15. For diamonds, the size tells the number of * on the longest row. The size must be an odd number not larger than 15. Enter the choice of your shape:24 Enter the size of your shape:8 ** *** **** ***** ****** ******* ******** Output 4 This program prints a shape with a certain size of your choice.- You have to select the shape from one of the following: 0 -- right-angled triangle with the right angle in the lower left- 1 -- right-angled triangle with the right angle in the upper left 2 -- right-angled triangle with the right angle in the lower right 3 -- a diamond After selecting the shape, you will be asked to input the size of the shape. For triangles, the size is the width and height of the triangle. This size must not be larger than 15. For diamonds, the size tells the number of * on the longest row. The size must be an odd number not larger than 15.- Enter the choice of your shape:34 Enter the size of your shape:6 Enter the size of your shape:9- [user input 6 is not valid, ask again] Enter the size of your shape.ge *** ***** ***** ******* ***** *** e We have developed the skeleton of PrintTriangle.java. The skeleton does not check user input and only prints out the shape of Choice 0. Develop the full version as described above

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 Databases Questions!