Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

K = (1/2)mv^2 Write a method that accepts mass and a velocity as arguments/param

ID: 3809285 • Letter: K

Question

K = (1/2)mv^2

Write a method that accepts mass and a velocity as arguments/paraments. The method should calculate and return the kinetic energy.

In the main method, asks the user to enter values of mass and velocity, then calls the method to get the results and print them.

The user input should be validated. If the user inputs are invalid, outputs a error message.

The program should repeadetly accept the user input and calculate the result until the user chooses not to.

In the end, the average value should be calculated.

The results should be formatted appropriately.

Do not use global variables for this program!!!

Java program for this problem, I like to use jGrasp for java.

Explanation / Answer

Kinetic Energy
In physics, an object that is in motion is said to have kinetic energy.
The following formula can be used to determine a moving object’s kinetic energy:
   KE = (12 ) mv^2


#include <iostream>
#include <cmath>
using namespace std;
double kineticEnergy(int, int);
int main()
{
int Mass,
Velo;
cout << " This program calculates the amount "
<< "of kinetic energy an object has. "
<< "Enter the object’s mass (in kilograms): ";
cin >> Mass;
cout << "Enter the object’s velocity (in meters per second): ";
cin >> Velo;
cout << "This object has is "
<< kineticEnergy(Mass, Velo) << " joules." << endl;
return 0;
}
double kineticEnergy(int Mass, int Velo)
{   
   return .5 * Mass * pow(Velo, 2);
}