Answered step by step
Verified Expert Solution
Question
1 Approved Answer
in this c + + program I need to complete the body and design of the function CylVol, which is designed to compute and return
in this c program I need to complete the body and design of the function CylVol, which is designed to compute and return the volume of a cylinder, based on the radius and the height given as input parameters
#include
#include
#include
using namespace std;
Global Data Declarations
None in this program
Function Prototypes
Computes the volume of a cylinder
float CylVolfloat radius, IN: Radius of cylinder
float height; IN: Height of cylinder
Function Name: main
Author: Timothy D Stedman
Date: May
Function Description:
The function will first ask the user for the radius and height of two
cylinders. It will then calculate the volume of both cylinders. Finally,
it will display two volumes formatted to decimal places.
Pseudocode:
Level
Ask user for Cylinder radius and height
Ask user for Cylinder radius and height
Calculate volume of Cylinder
Calculate volume of Cylinder
Set formatting for decimal places
Display volume of Cylinder
Display volume of Cylinder
Level
Ask user for Cylinder radius and height
Output "Cylinder : EOL
Output radius
Input rad
Output height
Input h
Ask user for Cylinder radius and height
Output EOL
Output "Cylinder : EOL
Output radius
Input rad
Output height
Input h
Calculate volume of Cylinder
vol CylVolrad h
Calculate volume of Cylinder
vol CylVolrad h
Display volume of Cylinder
Output EOL, EOL
Output "Volume of Cylinder vol cubic units.", EOL
Display volume of Cylinder
Output "Volume of Cylinder vol cubic units.", EOL
int main
Local constants
None in this function
Local variables
float rad; Radius of Cylinder
float h; Height of Cylinder
float rad; Radius of Cylinder
float h; Height of Cylinder
float vol; Volume of Cylinder
float vol; Volume of Cylinder
Begin main Function Executables
Ask user for Cylinder radius and height
cout "Cylinder : endl;
cout radius ;
cin rad;
cout height ;
cin h;
Ask user for Cylinder radius and height
cout endl;
cout "Cylinder : endl;
cout radius ;
cin rad;
cout height ;
cin h;
Calculate volume of Cylinder
vol CylVolrad h;
Calculate volume of Cylinder
vol CylVolrad h;
Set formatting for decimal places
cout fixed showpoint setprecision;
Display volume of Cylinder
cout
;
cout "Volume of Cylinder vol cubic units." endl;
Display volume of Cylinder
cout "Volume of Cylinder vol cubic units." endl;
Indicate to OS successful termination of program
return ;
End main
Function Name: CylVol
Author: Your Name
Date: XX May
Function Description:
The function compute the volume of a cylinder, based on the radius and the
height given as input parameters. The function will return the calculated
value through the function name.
Pseudocode:
Level
float CylVolfloat radius, IN: Radius of cylinder
float heightIN: Height of cylinder
Local constants
Local variables
Begin CylVol Function Executables
End CylVol
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started