Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

C++ *Please do not handwrite* MUST USE SWITCH BLOCK. Write a program that will p

ID: 3596771 • Letter: C

Question

C++ *Please do not handwrite*
MUST USE SWITCH BLOCK. Write a program that will provide the user a menu from which the user may select to calculate the volume of one of the four geometric solids: a cube, a sphere, a cylinder, and pyramid with the square base. You should use the most appropriate SWITCH BLOCK for this program. The user will input all of the data needed to calculate the area. The program should output all data input by the user, the calculated volume, and the geometric solid selected.
The volume can be calculated using the following formulas: Area of a cube =side^3 Area of a sphere =(4/3)*pi*radius^3 Area of a cylinder=pi*(radius^2)*height Area of a pyramid= (1/3)*base area*height; base area=length*width
Run the input using the following data: 1. select sphere and use the radius of 8.9 2. select the cube and use side= 14.1 3. select the cylinder and use height=1.4 and radius=3 4. Select the Pyramid and use height=21, base length=15 and base width=15 5. Make a selection not on the menu
C++ *Please do not handwrite*
MUST USE SWITCH BLOCK. Write a program that will provide the user a menu from which the user may select to calculate the volume of one of the four geometric solids: a cube, a sphere, a cylinder, and pyramid with the square base. You should use the most appropriate SWITCH BLOCK for this program. The user will input all of the data needed to calculate the area. The program should output all data input by the user, the calculated volume, and the geometric solid selected.
The volume can be calculated using the following formulas: Area of a cube =side^3 Area of a sphere =(4/3)*pi*radius^3 Area of a cylinder=pi*(radius^2)*height Area of a pyramid= (1/3)*base area*height; base area=length*width
Run the input using the following data: 1. select sphere and use the radius of 8.9 2. select the cube and use side= 14.1 3. select the cylinder and use height=1.4 and radius=3 4. Select the Pyramid and use height=21, base length=15 and base width=15 5. Make a selection not on the menu
C++ *Please do not handwrite*
MUST USE SWITCH BLOCK. Write a program that will provide the user a menu from which the user may select to calculate the volume of one of the four geometric solids: a cube, a sphere, a cylinder, and pyramid with the square base. You should use the most appropriate SWITCH BLOCK for this program. The user will input all of the data needed to calculate the area. The program should output all data input by the user, the calculated volume, and the geometric solid selected.
The volume can be calculated using the following formulas: Area of a cube =side^3 Area of a sphere =(4/3)*pi*radius^3 Area of a cylinder=pi*(radius^2)*height Area of a pyramid= (1/3)*base area*height; base area=length*width
Run the input using the following data: 1. select sphere and use the radius of 8.9 2. select the cube and use side= 14.1 3. select the cylinder and use height=1.4 and radius=3 4. Select the Pyramid and use height=21, base length=15 and base width=15 5. Make a selection not on the menu

Explanation / Answer

#include<stdlib.h>

#include<constream.h>

#include<iostream.h>

void main()

{

float pi=3.14, r=8.9,side=14.1,h=1.4,H=21,R=3,bl=15,bw=15;

int c;

clrscr();

cout<<" Enter which area to calculate";

cout<<" Enter 1 to calculate Area of a cube";

cout<<" Enter 2 to calculate Area of a sphere";

cout<<" Enter 3 to calculate Area of a cylinder";

cout<<" Enter 4 to calculate Area of a pyramid";

cout<<" 5 Selection not on the menu";

cin>>c;

switch(c)

{

case 1:

cout<<" Area of cube = "<<side*side*side ;

break;

case 2:

cout<<" Area of sphere = "<<(4/3)*pi*r*r*r ;

break;

case 3:

cout<<" Area of cylinder = "<<pi*(R*R)*h;

break;

case 4:

cout<<" Area of pyramid = "<<(1/3)*(bl*bw)*H;

break;

default:

cout<<"Entered invalid input";

}

}

[*** NOTE In the above program side =side, radius of sphere is "r" radius of cylinder is R, height of cylinder ="h" , height of pyramid= "H" , base lenght="bl" , base width ="bw" , pi=3.14,]