首页 > 试题广场 >

(物理:加速度)平均加速度定义为速度的变化量除以这个变化所

[问答题]
 (物理:加速度)平均加速度定义为速度的变化量除以这个变化所用的时间,如下式所示:
编写程序,提示用户输人以米 / 秒为单位的起始速度 V。 ,以米 / 秒为单位的终止速度 V,,以 及以秒为单位的时间段 /, 最后显示平均加速度。下面是一个运行示例:


package AA;
import java.util.Scanner;
public class ah {
    public static void main(String[] args){
                double v0=0,v1,t;
                System.out.print("Enter v0,v1,and t:");
                Scanner in=new Scanner(System.in);
                v0=in.nextDouble();
                v1=in.nextDouble();
                t=in.nextDouble();
                double a=0;
                a=(v1-v0)/t;
                System.out.print("The average acceleration is"+String.format("%.4f", a));
                
    }

}
发表于 2021-04-05 19:43:59 回复(0)