需要可以计算对象在0、1、2、3、4、5、6、7、8、9、10秒内下落的Java代码. [英] Need java code that can compute how far an object will fall in 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 seconds.

查看:168
本文介绍了需要可以计算对象在0、1、2、3、4、5、6、7、8、9、10秒内下落的Java代码.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使其看起来像这样,但是具有一个公式,该公式可以计算物体每秒钟掉落的英尺数.

秒距离(以英尺为单位)
0:0
1:16
2:64
3:144

我尝试过的事情:

我下面的这段代码与我上面试图做的类似,除了这段代码将华氏温度计算为摄氏温度.我希望上面的那个看起来像这个的输出,但是上面的信息和一个计算它的公式.我认为其中的公式部分是我遇到的困难.谢谢您的时间.

公共课FahrenheitToCelsius {
公共静态void main(String [] args){

System.out.println(华氏温度到摄氏温度");

for(int华氏= 1;华氏< = 10;华氏+ = 1){
双摄氏=华氏度ToCelsius(华氏);
System.out.println(+ fahrenheit +:" +摄氏度);
}
}

public static double fahrenheitToCelsius(double fahrenheit){

双摄氏= =(华氏-32)* 5/9;
返回摄氏度;

}
}

I am trying to make it look like this, but with a formula that can calculate how far the in feet the an object would fall every one second.

Seconds Distance in feet
0: 0
1: 16
2: 64
3: 144

What I have tried:

I have this code below that is similar to what I am trying to do above except this one calculates Fahrenheit to Celsius. I want the one above to look like the output to this one but with the information above and a formula to calculate it. I think the formula part of it is what I am having difficulty with. Thank you for you time.

public class FahrenheitToCelsius {
public static void main(String[] args) {

System.out.println("Fahrenheit to Celsius temperatures");

for (int fahrenheit = 1; fahrenheit <= 10; fahrenheit += 1) {
double celsius = fahrenheitToCelsius(fahrenheit);
System.out.println(+fahrenheit+": "+celsius);
}
}

public static double fahrenheitToCelsius(double fahrenheit) {

double celsius = (fahrenheit - 32) * 5 / 9;
return celsius;

}
}

推荐答案

我们不做您的作业:这是有原因的.在这里,您可以考虑自己被告知的内容,并尝试理解它.也可以在那里帮助您的导师识别您的弱点,并将更多的注意力放在补救措施上.
仅仅张贴您以前的作业分配代码,并希望我们能解决它"就显得过于乐观了.

自己尝试,您可能会发现它并不像您想的那么难!

如果您遇到特定问题,请询问此问题,我们将尽最大努力为您提供帮助.但是我们不会为您做所有这一切!
We do not do your homework: it is set for a reason. It is there so that you think about what you have been told, and try to understand it. It is also there so that your tutor can identify areas where you are weak, and focus more attention on remedial action.
Just posting up your previous homework assignment code and hoping we would "fix it" is rather over optimistic...

Try it yourself, you may find it is not as difficult as you think!

If you meet a specific problem, then please ask about that and we will do our best to help. But we aren''t going to do it all for you!


您知道,假设没有摩擦,公式为
You know, assuming no friction, the formula is
d = g * t * t / 2;


其中

  • d是距离.
  • g是标准重力常数(大约9.81 m/s/s).
  • t是时间(以秒为单位)秒.

  • Where

    • d is the distance.
    • g is the standard gravity constant (about 9.81 m/s/s).
    • t is the time in seconds.

    • 这篇关于需要可以计算对象在0、1、2、3、4、5、6、7、8、9、10秒内下落的Java代码.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆