【发布时间】:2018-12-24 17:36:16
【问题描述】:
我需要将 windCorrectionAngle 方法的返回值传递给 groundSpeed 方法,并将其放在表达式的最后(“windCorAng”)。这是唯一对我不起作用的部分。据我了解,这不是 Java 可以轻松完成的事情,因为它看不到其他方法的返回。很想学习如何做到这一点以及什么是正确的做法。我有一个简单的打印行来获取 grSpd 的结果。
public double windCorrectionAngle()
{
double windCorAng = Math.toDegrees(Math.asin
( vw * Math.sin( Math.toRadians (w-d) ) / va) );
return windCorAng;
}
public double groundSpeed()
{
double grSpd = Math.sqrt( Math.pow(va,2) + Math.pow(vw,2) - 2 * va * vw *
Math.cos(Math.toRadians(d - w - windCorAng)));
return grSpd;
}
【问题讨论】:
标签: methods parameters return