Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

MATLAB QUESTION: The formulas for determining the area and volume of three 3D shapes, 1. Cuboid, 2. Cylinder and 3. Sphere, are shown in the

image text in transcribed

MATLAB QUESTION: The formulas for determining the area and volume of three 3D shapes, 1. Cuboid, 2. Cylinder and 3. Sphere, are shown in the table and figure above.

Cuboid Cylinder Sphere A 2(lw wh +hl) The formulas for determining the area and volume of three 3D shapes, 1. Cuboid, 2. Cylinder and 3. Sphere, are shown in the table and figure above. Write a script HW5P3 that, i. (1 pt) displays a list of the 3D shapes and their numbers, ii. (1 pt) prompts the user to select a number 1 to 4, from the previously displayed list, ii. (5 pts) based on the user's selection, the program then asks the user to enter the required dimensions for determining the area and volume of the shape selected. For example, (the radius only for the sphere, the base radius and height for a cone, etc.) (6 pts) The program then determines the area and volume of that specific shape from the formulas given above and prints these values in the following format for a cylinder as an example, the program prints, "For a cylinder of XX in radius and XX in height, the surface area - XX in 2 and the volume XX in*3." xx is the number of each dimension with 2 decimals. iv. Similar text must be printed for every shape based on the name of the shape and its dimensions. (All dimensions are assumed to be in inches) (3 pts) If the user enters an invalid choice, the script simply prints an error message For example, if the user entered a number of shape that is not in the list or entered an invalid negative dimension, the script must print "Invalid Entry, please check your inputs and try again." v. Your script may combine between switch-case and if-else structures. (4 pts) Use your script with the following cases a. b. c. d. e. A cylinder of 3.5 inches radius and 5.2 inches height. A cube of 6.33 inches radius A sphere of 4.7 inches radius. A number of shape not in the list. For example, enter 6 for the shape number A sphere of -5 inches radius

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Semantics In Databases Second International Workshop Dagstuhl Castle Germany January 2001 Revised Papers Lncs 2582

Authors: Leopoldo Bertossi ,Gyula O.H. Katona ,Klaus-Dieter Schewe ,Bernhard Thalheim

2003rd Edition

3540009574, 978-3540009573

More Books

Students also viewed these Databases questions

Question

16. We do not allow used merchandise to be returned or exchanged.

Answered: 1 week ago