Manya C.

asked • 03/31/21

A Java Program to calculate the kinetic energy of a ball (check description)

BACKGROUND:

A solid iron ball with a radius r and mass m is rolling on a surface without slipping with a constant linear velocity v and angular velocity ω. The total kinetic energy Kt of the ball is the sum of its linear kinetic energy Kl and its angular kinetic energy Ka where Kt = Kl + Ka Kl = ½* m* v 2 Ka = ½* I* ω 2 ω v ω= v / r the moment of inertia for a solid ball I = 0.4*m*r2 m = 4/3 * π * r3 * ρ where density ρ for iron is 7.8 kg/m3 .

CODING REQUIREMENTS:

Can someone write a Java program with a single class and a single method (the main() method) to calculate the Kinetic Energy for any given ball. You can use the methods predefined in Math class. Your program shall be compliable by JDK SE 8 Your program shall have only one class that contains only one method main(). You should follow common programming practices and give meaningful identifiers to declared variables (avoid a, x, v, r, …). Your program shall define symbolic constants for all values which have a physical meaning, are currently fixed, but there is a chance that they may be changed in future such as ρ for other materials. However, there is no need to define symbolic constants for those values which are permanently built into formulas and will never be changed. Your program shall use the printf() method to print the final output. In this assignment, you can presume that the user input always corrects (input verification is not required). Your program shall input parameters in the following order: - ball radius r (meters) - ball linear velocity v (meters/second) The program shall perform all calculations with double precision. The total kinetic energy shall be displayed with two decimal point precision. An example with one test case is shown below. Use a calculator to prepare other test cases to make sure your program operates properly.

Please make sure the output of your program is the same as the following example.

Example of the program output: *** Kinetic energy calculation *** Enter the following parameters - Radius of the ball (m): 1.0 - Linear velocity of the ball (m/s): 1.0 The total kinetic energy is 22.87 (J) The program has terminated.


1 Expert Answer

By:

Patrick B. answered • 03/31/21

Tutor
4.7 (31)

Math and computer tutor/teacher

Manya C.

Kt = Kl + Ka ; Kl = ½* m* v ^2 ; Ka = ½* I* ω ^2; ω= v / r ; the moment of inertia for a solid ball I = 0.4*m*r^2; m = 4/3 * π * r3 * ρ ; where density ρ for iron is 7.8 kg/m^3; These are the formulas, much clearer.
Report

04/01/21

Still looking for help? Get the right answer, fast.

Ask a question for free

Get a free answer to a quick problem.
Most questions answered within 4 hours.

OR

Find an Online Tutor Now

Choose an expert and meet online. No packages or subscriptions, pay only for the time you need.