Question: I have given you a program named FuncCallingFunc.cpp This program has main() and eight functions float areaCircle(float radiusIn); float circumCircle(float radiusIn); float areaSphere(float radiusIn); float
I have given you a program named FuncCallingFunc.cpp
This program has main() and eight functions
- float areaCircle(float radiusIn);
- float circumCircle(float radiusIn);
- float areaSphere(float radiusIn);
- float circumSphere(float radiusIn);
- float volumeSphere(float radiusIn);
- float areaCylinder(float radiusIn, float heightIn);
- float volumeCylinder(float radiusIn, float heightIn);
- float volumeCone(float radiusIn, float heightIn);
The challenge of this assignment is to reduce some redundant code by allowing functions to call other functions
Example
1. the function areaCircle(float) calculates the area of a given
circle using the equation
area = PI * radius * radius
- the function areaCylinder(float, float) calculates the surface area of a given cylinder using the equation
area = 2 * PI * radius * radius +
height * PI * radius * 2
By calling the function areaCircle(float) and
circumCircle(float) the above equation can be shortened to
area = 2 * areaCircle(radius) +
height * circumCircle( radius);
You just have to change the code in some functions to call other functions
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
