Question: Hello, I need some help with C++ programming. I would appreciate if some comments were included with the program to understand functions, processes, etc. Thank
Hello, I need some help with C++ programming. I would appreciate if some comments were included with the program to understand functions, processes, etc. Thank you!
This program is a Physics Calculator.
You will create a menu which allows the user to select a calculation to be performed. Once the selection has been made, call a function to: (1) prompt for the parameters for the problem and validate them. (2) call a different function to calculate a result and return it, and (3) display the returned result.
The Menu should be displayed in a loop until the user elects to quit.
Your program should require all input values to the functions that calculate a result to be positive ( greater than zero ). It should also generate an error message if an invalid menu selection is made.
The functions to be coded are:
1. Speed( ): Compute the speed of an object after t seconds of acceleration given that the object was initially travelling at v meters per second and then accelerated at a meters per second per second, where speed = v + at.
2. Distance( ): Compute the distance travelled in t seconds by an object that started at rest and then accelerated at a meters per second per second, where distance = at2/2.
3. BarVolume( ): Compute the volume of a rectangular bar with width w, length l, and height h, where bar volume = wlh.
4. SphereVolume( ): Compute the volume of a sphere with radius r, where sphere volume = 4pr3/3.
5. CylinderVolume( ): Compute the volume of a cylinder with radius r and height h, where cylinder volume = pr2h.
Declare a global named constant PI and assign it the value: 3.1415926535 const double PI = 3.1415926535;
Use the named constant PI in the calculations for the SphereVolume and the CylinderVolume.
All of the functions that calculate a value should take arguments of type double and return a value of type double.
Note: The use of the name speed or distance may conflict with a function that already exists in one of the standard library files you include. To avoid any name conflicts, name your functions as shown above ( start function names with capital letters ).
Do NOT use any global variables!
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
