Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Program Specification - Write a class named ComputeCompression that contains a main method. - There should be one .java file (i.e ComputeCompression.java) - Use a
Program Specification - Write a class named ComputeCompression that contains a main method. - There should be one .java file (i.e ComputeCompression.java) - Use a package named edu.ttc.egr281 Program Submission Create a ZIP file that contains only .java files (no .class files). The zip file must use the naming convention: A 2. zip Ex: SmithA2.zip Submit the ZIP file via D2L. Grading Style: Comments and Indentation Functionality: Complies, Runs, and Produces correct output The program will be evaluated using test cases developed by the instructor. Late assignments cannot be accepted. 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. Assume a crate is dropped from a height of y=5m, determine the value of x (amount of spring compression) if the crate has a mass of 4kg. The spring constant units are N/m. The program should prompt the user to enter a value for the spring constant (N/m). The spring constant, k, should be an integer and should not be 0 . It also should not be less than 0 . The value should be no more than 3,000 because a higher k value would mean a higher cost. If the value entered does not meet these requirements, then the program should display invalid input. Conservation of energy equation: mgh=1/2kx2 Where h=y plus the distance the spring is compressed. g=9.81 (gravity) mg(5+x)=1/2(k)x2 1/2kx24gx20g=0 (solving the equation results in a quadratic equation). 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
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started