Physics finding runway length

The problem

Given an airplaneā€™s acceleration a and take-off speed v, you can compute the minimum runway length needed for an airplane to take off using the following formula: length = v2 / 2a

Write a program that requests the user to enter v in meters/second (m/s) and the acceleration a in meters/second squared (m/s2), and displays the minimum runway length. Here is a sample run:

Enter speed and acceleration: 60 3.5
The minimum runway length for this airplane is 514.286

Breaking it down

public static void main(String[] Strings) {

    Scanner input = new Scanner(;

    System.out.print("Enter speed and acceleration: ");
    double speed = input.nextDouble();
    double acceleration = input.nextDouble();


    double minLength = lengthTraveled(speed, acceleration);
    System.out.print("The minimum runway length for this airplane is "
            + minLength);

private static double lengthTraveled(double speed, double acceleration) {
    double length = (speed * speed) / (2 * acceleration);
    return length;


Enter speed and acceleration: 55 2.8
The minimum runway length for this airplane is 540.1785714285714