Kinetic Energy (KE) is given by ?? =
1
2
??2
where m is the mass of an object
(kilograms) and v is the velocity (meters/second).
Potential Energy (PE) is given by ?? = ??ℎ where m is the mass of an
object (kilograms), g is the acceleration due to gravity (a constant which
equals 9.81 m/s2
) and h is the height (meters).
KE and PE are measured in Joules (1 Joule = 1 kg m2
/s2
).
Create an application in VB that allows the user to enter an object’s mass,
velocity, and height and displays the object’s KE and PE. The application
should have a two functions: KineticEnergy that accepts an object’s mass
(kilograms) and velocity (meters/second) as arguments and PotentialEnergy
that accepts an object’s mass (kilograms), acceleration due to gravity (m/s2
),
and height (meters) as arguments. The function should return the objects KE
and PE (3 decimal places).
Input validation: Use TryParse method for input validation. Do not accept a
negative number for the mass, velocity, and height. Ensure that all values are
numeric. The Clear button must clear the text boxes and the label that displays
Kinetic and Potential Energy.
The name of Programming Assignment 6 is KPENERGY. Name the
folder PA6_YourGroup (e.g., PA6_
Sample Solution