Question: Program Requirements Using the conservation of energy, an engineer needs to determine how much a spring is compressed to determine the effectiveness of the spring.

Program Requirements
Using the conservation of energy, an engineer needs to determine how much a spring is compressed to determine the effectiveness of the spring. Assuming a crate with a varying mass is dropped from a specified height, determine the value of x(amount of spring compression).
The program should prompt the user to enter the height in meters (m), mass of the crate in kilograms (kg), and the spring constant value (Nm). The height and mass should be greater than 0. The spring constant, k, should be an integer, should be greater than 0, and should be no more than 2,500 because a higher k value would mean a higher cost. If the value entered does not meet these requirements, then the program should display the message "Invalid input" and the program should end.
Conservation of energy equation: mgh=12kx2
Where
h=y plus the distance the spring is compressed.
g= gravity (9.81)
As example with height of 5m(y) and mass of 4kg(m) :
mg(y+x)=12(k)x2
12kx2-4gx-20g=0(solving the equation results in a quadratic equation). Since the values of height and mass will vary, the values in the quadratic equation will change.
To assist in the engineering analysis of the other parameters, write a Java program to solve for the value of x. The output should be two values. As an example, "The amount of spring compression, x, is 0.705 meters and -4.326 meters".
 Program Requirements Using the conservation of energy, an engineer needs to

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!