A function CalcPyramidVolume is defined with parameters (all having data type double ) baseLength, baseWidth, and pyramidHeight, which returns as a double pyramid volume with a rectangular base. From CalcPyramidVolume() function, the function CalcBaseArea() is calculated. Required program is written in C++:
#include <iostream>
double calcPyramidVolume(double, double, double);
double calcBaseArea(double, double);
using namespace std;
int main()
{
double baseLength, baseWidth, pyramidHeight;
cout<<"Enter Base Lenght : ";
cin>>baseLength;
cout<<"Enter Base Width : ";
cin>>baseWidth;
cout<<"Enter pyramid Height : ";
cin>>pyramidHeight;
double PyramidVolume = calcPyramidVolume( baseLength, baseWidth, pyramidHeight);
cout<<"Pyramid Volume : " << PyramidVolume;
return 0;
}
double calcBaseArea(double base_Length, double base_Width)
{
return base_Length * base_Width;
}
double calcPyramidVolume(double Length, double Width, double Height){
double baseArea = calcBaseArea(Length, Width);
double volume = baseArea * Height;
return volume;
}
Output is attached below:
You can learn more about C++ Program at
https://brainly.com/question/27019258
#SPJ4