Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Objective to use Select Case and get experience writing functions.Write the program to cycle until the users chooses to stop. Look at Lecture code for

Objective to use Select Case and get experience writing functions.Write the program to cycle until the users chooses to stop. Look at Lecture code for While Loop structure, dont forget the input at end of while.We will use geometric objects in this lab.Object one: Circle defined by radius. Write 2 functions one to compute the area of a Circie and the other to compute the volume of a cylinder.Object two: Triangle See explanation below that defines a triangle by 3 sides where any 2 sides must be greater than the third. So, if you pick 2 sides then the third side must be greater than the sum of the first 2. Example: side 1=5 side 2+ side 3>5Note the Area of a triangle can be computed with only the 3 sides by herons formula: Write 2 functions, one to compute the area of a triangle (using herons formula) and one to compute the volume of a 3D object with cross-section of a triangle and height.Object three: Parallelogram defined by two adjacent sides and the included angle. Write 2 functions, one to compute the area of the parallelogram and one to compute the volume of a 3D object with cross-Section of the parallelogram and height.Requirements:Write a script and 6 functions, one for each of the 6 objects above. The script will use a switch case statement to select one of the 6 objects, 32D objects and 33D objects. Then in each case you will call a function to solve for the mathematical answers.1. Prior to Switch/Case you must ask the user to choose which object they wish to solve. The target variable of the Switch may be a numeric variable or a string.2. Switch case with 6 active cases and otherwise. 3. In each case the appropriate user inputs must be requested via input statements. See Object descriptions above for the appropriate respective inputs for each unique object. The 3D objects have one more parameters which is height.4. These inputs will become the input parameters to the function you call.5. The function will return outputs that are the answers back to the case for display to the user. Requirements:1. In the script ask the user to choose one of these 3 areas or 3 volumes. What statement do you need here to have the user input this data? This will be a single variable of type integer or string (string can be a single character.) Note if you input a string s must follow the prompt and be inside the right parenthesis. The dimensions will of course be numeric the objects names will be strings.2. Use a switch case statement with the above 6 tasks as the specific cases and then an otherwise case. Seven cases in total since Otherwise is a case.Write 6 functions that are called in the six cases:For each case do the following:a. Ask the user for the parameter(s) you need. e.g. for area of square you only need the side. Other areas and volumes you will need the variables to solve for area or volumeb. Call a function to solve for the area or a different function for the volume of the object selected by the user. Note the call to a function will be in the form:Variable = name-of-function (parameter list ); Parameter list is the items values in 3 above. The parameter values need to be the items necessary to calculate area or volume respectively.c. Use fprintf to output the answer e.g. Area or Volume of the specific object.3. Each function will have1 output variable, and inputs based on the data needed to compute the area of the cross-sectional shape i.e. circle, triangle, or parallelogram. In the volume functions you need to add the height plus parameters for the area.

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

Data Access Patterns Database Interactions In Object Oriented Applications

Authors: Clifton Nock

1st Edition

0321555627, 978-0321555625

More Books

Students also viewed these Databases questions

Question

How do Dimensional Database Models differ from Relational Models?

Answered: 1 week ago

Question

What type of processing do Relational Databases support?

Answered: 1 week ago

Question

Describe several aggregation operators.

Answered: 1 week ago