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

  1. float areaCircle(float radiusIn);
  2. float circumCircle(float radiusIn);
  3. float areaSphere(float radiusIn);
  4. float circumSphere(float radiusIn);
  5. float volumeSphere(float radiusIn);
  6. float areaCylinder(float radiusIn, float heightIn);
  7. float volumeCylinder(float radiusIn, float heightIn);
  8. 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

  1. 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

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!