Question 4 (25 pts) Write a script 'shapes that when run prints a list consisting of "cylinder", "cube", "sphere". It pr

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899604
Joined: Mon Aug 02, 2021 8:13 am

Question 4 (25 pts) Write a script 'shapes that when run prints a list consisting of "cylinder", "cube", "sphere". It pr

Post by answerhappygod »

Question 4 25 Pts Write A Script Shapes That When Run Prints A List Consisting Of Cylinder Cube Sphere It Pr 1
Question 4 25 Pts Write A Script Shapes That When Run Prints A List Consisting Of Cylinder Cube Sphere It Pr 1 (67.83 KiB) Viewed 42 times
Question 4 (25 pts) Write a script 'shapes that when run prints a list consisting of "cylinder", "cube", "sphere". It prompts the user to choose one, and then prompts the user for the relevant quantities e.g. the radius and length of the cylinder and then prints its surface area. If the user enters an invalid choice like 'O' or '4' for example, the script simply prints an error message. Similarly for a cube it should ask for side length of the cube, and for the sphere, radius of the sphere. You can use three functions to calculate the surface areas or you can do without functions as well. The script should use nested if-else statement to accomplish this. Here are the sample outputs you should generate (ignore the units): >> shapes Menu 1. Cylinder 2. Cube Sphere Please choose one: 1 Enter the radius of the cylinder: 5 Enter the length of the cylinder: 10 The surface area is: 314.1593 3. >> shapes Menu 1. Cylinder 2. Cube 3. Sphere Please choose one: 2 Enter the side-length of the cube: 5 The volume is: 150.0000 2. >> shapes Menu 1. Cylinder Cube 3. Sphere Please choose one: 3 Enter the radius of the sphere: 5 The volume is: 314.1593
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply