Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

This code prompts for and reads in the radius and height of a right cylinder in feet and then calculates the surface area. The function

image text in transcribedThis code prompts for and reads in the radius and height of a right cylinder in feet and then calculates the surface area. The function prototype, function definition, and function call to calculate and print the base area has already been completed for you. In the above program, r and h are declared in the main function and are local to main, while the constant PI is defined globally. Since r is a local variable, notice how the radius r must be passed to calcBaseArea to make this calculation. One of your tasks is to add a new function called calcSideArea that computes and returns the side area of the right cylinder. Given that the formula uses both the radius r and height h of the right cylinder, you must pass these two local variables to this function. You will assign the returned value of this function to side_area and then print the value to the terminal. Refer to what was done for calcBaseArea when adding your code. 6 Your other task is to add a new function called prntSurfArea that accepts the base area and side area values (i.e., these are the parameters) and prints out the total surface area of the right cylinder inside this function. Since this function does not return a value to the calling function, the return type of this function should be void. Now, modify the above program, referring to the comments included in the code. Complete the requested changes,

int main(0 // height /I radius float h; float r float base_area; // area of base float side_area; // area of side cout r cout >h; base_area-calcBaseArea(r); cout

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Beginning VB.NET Databases

Authors: Thearon Willis

1st Edition

1594864217, 978-1594864216

More Books

Students also viewed these Databases questions