Question: Need the code in C++, following the parameters given above. We cannot use arrays or global variables, we can use experssions and interactivity, making decisions,

 Need the code in C++, following the parameters given above. We

Need the code in C++, following the parameters given above. We cannot use arrays or global variables, we can use experssions and interactivity, making decisions, loops and files, and functions (Chpt. 1 thru 6 in the Book) The simpler this program is written the better.

Goals: Practicing functions using pass by value and pass by reference parameters 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 has a volume of and a height of and a surface are of You do not have to worry about units, but can use a string variable for them if you w ould 1 Your function to check the validity of entered dimension should be a value-returning function ts 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-ent as er when it is invalid The error message should contain which dimension is incorrect such 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 f should return a valid value to the function call. Your second fiunction should be a void finction that wil calculate the voltume and surfiace then send these values back to the function call Do not use the same identifiers for variables in multiple functions! Carefily choose 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 hould 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 ourput 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!