Java语言程序设计基础篇编程练习题2.9示例代码

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/qq_38234015/article/details/88316296
import java.util.Scanner;

public class Test2_09 {
	public static void main(String[] args) {
		Scanner input = new Scanner(System.in);
		System.out.print("Enter v0, v1, and t: ");
		double v0 = input.nextDouble();
		double v1 = input.nextDouble();
		double t = input.nextDouble();
		input.close();
		
		double acc = (v1 - v0) / t;
		
		System.out.println("The average acceleration is " + acc);
	}
}

猜你喜欢

转载自blog.csdn.net/qq_38234015/article/details/88316296