C++ The kinetic energy of a moving object is found using the following equation:
ID: 3592431 • Letter: C
Question
C++
The kinetic energy of a moving object is found using the following equation: K=(1/2)(MV2)
Where: K is the kinetic energy in kgm/s
M is the mass in kilograms
V is the velocity, in meters per second
Write a complete program that accepts inputs of mass and velocity of an object from the user and determines the kinetic energy. Display the mass, velocity, and kinetic energy at the end of the program. To test your program, execute the program using m=200kg, v=3.7 m/s and then execute it again using m=925kg, v=8m/s.
Explanation / Answer
#include <iostream>
#include <math.h>
#include <iomanip>
using namespace std;
int main()
{
double mass, velocity, energy;
cout<<" Enter the Object weight in Kilograms: ";
cin>>mass;
cout<<" Enter the Object velocity in meters per second: ";
cin>>velocity;
energy = (1.0 / 2.0) * (mass * velocity) * 2;
cout<<fixed <<setprecision(2);
cout<<" Mass = " <<mass <<"kg";
cout<<" Velocity = "<<velocity <<"m/s";
cout<<" Kinetic Energy = " <<energy <<"kgm/s";
return 0;
}
OUTPUT
Enter the Object weight in Kilograms: 200
Enter the Object velocity in meters per second: 3.7
Mass = 200.00kg
Velocity = 3.70m/s
Kinetic Energy = 740.00kgm/s
Enter the Object weight in Kilograms:
Enter the Object velocity in meters per second:
Mass = 925.00kg
Velocity = 8.00m/s
Kinetic Energy = 7400.00kgm/s
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.