Question: Write a program to calculate the volume of box and cylinder object with input/output specifications as described below: Command Prompt Repeatedly asking users for valid

 Write a program to calculate the volume of box and cylinderobject with input/output specifications as described below: Command Prompt Repeatedly asking usersfor valid selection of object: 'b' for box and 'C' for cylinder

Write a program to calculate the volume of box and cylinder object with input/output specifications as described below: Command Prompt Repeatedly asking users for valid selection of object: 'b' for box and 'C' for cylinder 1 D:\temp\SECJ1013\Topic4>assg2 b - Box c - Cylinder Choose object (b/c): k b - Box lc - Cylinder Choose object (b/c): b 1 1 1 Repeatedly asking users for valid input of object parameters (must be an integer > 0) 1 Width: 0 I Width: 2 Height: -1 Height: 3 ! Length: 4 1 Volume of box = 24 Calculate and display the volume of the object based on the inputs given by the users: box volume => width * height + length => 2 * 3 * 4 => 24 :\temp\SECJ1013\Topic4>assg2 b - Box C - Cylinder Choose object (b/c): C 1 1 1 1 1 1 I Radius: 3 i Length: 4 Example of input and output for cylinder type object 1 1 1 Volume of cylinder = 113.04 D:\temp\SECJ1013\Topic4>. Your program must be written by following the specifications and logic as depicted in the below flowchart: Start setParam(w. h, 1) setParam(r, 1) #define PI 3.14 int width=0, height=0, length=0, radius=0 float area=0, volume=0 w = getParam"Width:") r = getParam("Radius: ") h = getParam("Height:") = getParam("Length: ") char object = chooseObject() I = getParam("Length:") FALSE Return object == 'b' setParam(radius, length) TRUE Return area = areaCircle(radius) setParam(width, height, length) getParam(pname) volume = area * length area = areaRect(width, height) Display pname Read pvalue Display cylinder volume volume = area * length TRUE pvalue #include #define PI 3.14 using namespace std; // function prototypes float areaCircle (int); float areaRect(int, int); int get Param (string); void setParam (int &, int &); void setParam (int &, int &, int &); char chooseObject(); // start main function int main() { return 0; }

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!