Question: (In C++) Problem: Create a program that will calculate the volume and surface area of a cone using a function other than main. Your program

(In C++) Problem: Create a program that will calculate the volume and surface area of a cone using a function other than main. Your program will contain two functions other than main: one to check the validity of the entered dimensions and one to calculate the volume and surface area of the cone. Your main function (acts like a driver for your other 2 functions) should prompt the user to enter the radius and height of the cone. Next call the function to check the validity twice, once for the radius and once for the height. Next call the function to calculate the volume and surface area. Finally output the dimensions and the volume an surface area with a message similar to A cone with radius of ____________ and a height of _____________ has a volume of______________ and a surface are of _____________. You do not have to worry about units, but can use a string variable for them if you would like. Your function to check the validity of entered dimension should be a value-returning function that accepts two parameters: one a double for the dimensions and one a string for what the dimension represents (such as radius of cone or height of cone).Then use a while loop (with no branches) to confirm that the user entered a valid value for that dimension and prompt the user to re-enter when it is invalid. The error message should contain which dimension is incorrect such as The radius of the cone cannot be negative. Please re-enter the radius of the cone. You do not have to confirm that the user entered a number rather than a character. The function should return a valid value to the function call. Your second function should be a void function that will calculate the volume and surface, then send these values back to the function call. Do not use the same identifiers for variables in multiple functions! Carefully choose which parameters should be pass by reference and which should be pass by value. Remember that your function definitions should appear after main and your program should contain the usual introductory comments at the beginning of the file plus comments specific to each function immediately before that function. The function comments should contain the purpose of the function, input needed (passed to the function and/or interactive input within the function), output from the function (returned back to the function call and/or output to screen), and processing (how to get the output from the input).

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!