Answered step by step
Verified Expert Solution
Link Copied!

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" and/or "sqrt" to do the calculations. Along with this you will use acos(-1) for an estimation on . This value must be saved using a constant variable.You will need to have a file Smith11.cpp, where Smith is your last name and '11' is the assignment number. You can follow the same guide lines given in assignment 4.
Start up your IDE software and create your Smith11.cpp 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(-1)".
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. i.e. if the choose "1" 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 5 and height 3.5 is 91.63.
The volume of a cone with radius 5.2 is 588.98.
The area of the octagon with side length 3.4 is 55.82.
The distance between the two give points is (3,2) and (1.5,6.5) is approximately 4.7434.
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 (i.e., 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

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

Successful Keyword Searching Initiating Research On Popular Topics Using Electronic Databases

Authors: Randall MacDonald, Susan MacDonald

1st Edition

0313306761, 978-0313306761

More Books

Students also viewed these Databases questions

Question

25.0 m C B A 52.0 m 65.0 m

Answered: 1 week ago