Question: Chapter 3 - Physics Class Instructions Write a program that determines kinetic energy and potential energy given the needed parameters by physics students. The physics
Chapter 3 - Physics Class
Instructions
Write a program that determines kinetic energy and potential energy given the needed parameters by physics students. The physics students are running experiments and need a program that will determine kinetic and potential energy. Create a class named Physics (20pts) with the following data members (20pts) or instance fields.
- string name - the name of the student
- double mass - the amount of mass
- double velocity - the velocity
- double acceleration - the acceleration
- double height - the height
- double ke - kinetic energy
- double pe - potential energy
The class should include the appropriate getters (10pts)and setters (10pts) for each data member needed as well as specialized functions, which are called (demo) by the main function. The following is a list of functions (20pts) expected.
- Physics - Constructor
- setName - Mutator or setter for name
- getName - Accessor or getter for name
- setMass - Mutator or setter for mass
- getMass - Accessor or getter for mass
- setVelocity - Mutator or setter for velocity
- getVelocity - Accessor or getter for velocity
- setAcceleration - Mutator or setter for acceleration
- getAcceleration - Accessor or getter for acceleration
- setHeight - Mutator or setter for acceleration
- getHeight - Accessor or getter for acceleration
- calcKE - calculates kinetic energy (you can name this getKE if you'd like)
- calcPE - calculates potential energy (you can name this getPE if you'd like)
KE = 1/2 * mass * velocity * velocity
PE = mass * acceleration * height
Sample Output Sample Input
Please enter the student name: Stark
Please enter the mass:10
Please enter the velocity:10
Please enter the acceleration:10
Please enter the height: 10
Stark, your kinetic energy amount is: 500
Your potential energy is: 1000
*****Headiing Required
****Comment all significant lines of code
****Turn in only .cpp or .h files individually no zip needed.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
