跑道长度 = v * v / 2a
编写程序,提示用户输入以米/秒(m/s)为单位的速度v和以米/秒的平方为单位的加速度a,然后显示最短跑道长度。下面是一个运行示例:
Enter speed and acceleration: 60 3.5
The minimum runway length for this airplane is 514.286
package Second;
import java.util.Scanner;
public class Code12 {
public static void main(String[] args) {
System.out.println("Enter speed and acceleration:");
Scanner input = new Scanner(System.in);
double v = input.nextDouble();
double a = input.nextDouble();
double runway = v * v / 2 /a;
System.out.println("The minimum runway length for this airplane is :" + runway);
}
}
输出
Enter speed and acceleration: 60 3.5 The minimum runway length for this airplane is :514.2857142857143



