Answered step by step
Verified Expert Solution
Question
1 Approved Answer
In this assignment, you will complete a C + + program that asks the user to make a choice off a menu that will be
In this assignment, you will complete a C program that asks the user to make a choice off a menu that will be displayed to them. The user can make as many selections as they wish. The last choice from the menu will give them an option to stop.
The menu choices will be the following four calculations:
Find the volume of a cone formula can be found hereLinks to an external site.
Find the volume of a sphere formula can be found hereLinks to an external site.
Find the area of octagon formula can be found hereLinks to an external site. Use the area formula posted by CB Singh
Find the distance between two points formula can be found hereLinks to an external site.
Stop
For the different formulas, you will need to do some different function calculations these either finding the square root of a value, finding a number raised to a power or both. You must use the cmath library functions "pow" andor "sqrt" to do the calculations. Along with this you will use acos for an estimation on This value must be saved using a constant variable.You will need to have a file Smithcpp where Smith is your last name and is the assignment number. You can follow the same guide lines given in assignment
Start up your IDE software and create your Smithcpp source code file.
Be sure you have the comment block at the top of the source code file that has all the information that applies to this assignment. In the Assumptions field and Limitations field, say "estimation of pi is acos
The main function allows the user to pick from the menu. Depending on what choice they make they will be prompted for all the values that will be needed to make the requested calculations. ie if the choose then they will be asked for the radius and the height. The outputs must be similar to the following:
The volume of a cone with radius and height is
The volume of a cone with radius is
The area of the octagon with side length is
The distance between the two give points is and is approximately
Required parts of the program:
You must use a do while" loop to allow the user to choose from the menu.
You must use a "switch statement" to process the users choice.
You must use the above mentioned cmath functions in your calculations.
You must make a user define function for the fore mentioned formulas. Each function must have a prototype statement that is before the beginning of the "main" function with the function declaration after the end of the "main" function. Each function must receive all the values needed to make the calculation and return the result.
No output to the screen is to done from any of the functions.
If you have any questions be sure to contact the instructor.
Save the contents of the file
Use your IDE to compile the contents of your source code file
If any syntax errors are detected by the g compiler, or any warning messages appear, correct the errors, save the contents of your source code file, and recompile the file. Continue this step until all syntax errors in the program are corrected and no warning messages appear
Link the program. The g compiler automatically performs this link step for you after you compile the program if your program contains no syntax errors
Test your program by running it several times with different floating point values to check that you have implemented the algorithms correctly. If any logical errors occur ie program does not fulfill the requirements or produces incorrect output make corrections in your source code file, save the file, compile and link the file, and run the program again. Continue to do this step until the logical errors are corrected.
Submit the softcopy of your source code file. Do NOT submit a copy of your executable file.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started