已知自由落体位移公式为 s=1/2gt^2+v0t 其中v0为初始速度,g为重力速度,T为历程时间,编写程序,求位移量S.要用java详细的写出来.

来源:学生作业帮助网 编辑:作业帮 时间:2024/05/08 18:29:22

已知自由落体位移公式为 s=1/2gt^2+v0t 其中v0为初始速度,g为重力速度,T为历程时间,编写程序,求位移量S.要用java详细的写出来.
已知自由落体位移公式为 s=1/2gt^2+v0t 其中v0为初始速度,g为重力速度,T为历程时间,编写程序,求位移量S.
要用java详细的写出来.

已知自由落体位移公式为 s=1/2gt^2+v0t 其中v0为初始速度,g为重力速度,T为历程时间,编写程序,求位移量S.要用java详细的写出来.
import java.io.*;
public class Test{
\x05public static double V0;
\x05public static double t;
\x05public static double g = 9.8;
\x05public static void main(String args[]){
\x05\x05System.out.println("input v0,t");
\x05\x05try{
\x05\x05\x05 BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
\x05\x05\x05 String str = "";
\x05\x05\x05 while((str=br.readLine())!=null){
\x05\x05\x05 String details[] = str.split(" ");
\x05\x05\x05 System.out.println(Double.parseDouble(details[0]));
\x05\x05\x05 double s ;
\x05\x05\x05 s = Double.parseDouble(details[0])*Double.parseDouble(details[1])+
\x05\x05\x05\x05\x05 0.500*g*Double.parseDouble(details[1])*Double.parseDouble(details[1]);
\x05\x05\x05 System.out.println(s);
\x05\x05\x05 }
\x05\x05 }catch(Exception e){
\x05\x05\x05 e.printStackTrace();
\x05\x05 }
\x05 }
}
你输入的数据精度越大,求出的数据精度就越大