HangTime - double xTwo = (-B - Math.sqrt(B * B - 4 * A *...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
import java.lang.Math; import java.io.PrintStream; i public class HangTime { public static void main (String [] args) { final double ACCEL_G = 9.8; final double INITIAL_VEL = 4.8597; f final double A = (1.0 / 2)* ACCEL_G; final double B = -INITIAL_VEL; final double C = 1; f double xOne = (-B + Math.sqrt(B * B - 4 * A * C))/(2.0 * ACCEL_G);
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: double xTwo = (-B - Math.sqrt(B * B - 4 * A * C))/(2.0 * ACCEL_G); d PrintStream output = System.out; output.printf("xOne: %.2f%n", xOne); output.printf("xTwo: %.2f%n", xTwo); o double hangTime = Math.abs(xTwo - xOne); output.printf("HangTime: %.2f%n", hangTime); } }...
View Full Document

Ask a homework question - tutors are online