在我的练习中,我需要使用练习中给出的一些数学方程来计算跳伞者的速度变化。我输入质量 = 80kg 高度 = 39000 m
我必须在屏幕上显示此消息: System.out.printf("%.0f, %.4f, %.4f, %.5f\n", t, height, speed, accel);
通常,我应该有这个结果:
> 133, 1991.2751, 284.9225, -79.22827
> 134, 1742.1436, 216.8788, -57.96464
> 135, 1551.4499, 167.0971, -42.40784
> 136, 1403.5103, 130.6760, -31.02624
但不幸的是,这就是我屏幕上的内容:
< 133, 1991.2751, 284.9224, -79.22826
< 134, 1742.1436, 216.8788, -57.96463
< 135, 1551.4499, 167.0971, -42.40783
< 136, 1403.5103, 130.6759, -31.02623
这是我的代码:
final double g = 9.8100;
float surface = 2;
int tf = 171;
double v0 = 00.0;
double t0 = 00.0;
for (double t = 0; t < tf; t++)
{
double height= h0;
double speed= v0;
double accel = 9.81;
double s = surface / mass;
double q = Math.exp(-s * (t - t0));
speed= (g / s) * (1 - q) + (v0 * q);
accel = g - (s * vitesse);
height= h0 - ((g / s) * (t - t0)) - ((v0 - (g / s)) / s) * (1 - q);
if ((height<= 2500) && (height> 2300))
{
surface = 25;
System.out.println("## The parachutist open his parachute");
t0 = 132;
v0 = 377.927;
h0 = 2320.2818f;
}
// Display on the screen
System.out.printf("%.0f, %.4f, %.4f, %.5f\n",
t, height, speed, accel);
}
你能帮我吗 ?
编辑:方程式:http ://www.casimages.com/img.php?i=131027115003602313.png