我有一个计算热量指数的方程。老师提供了方程,我把它复制对了,但它没有看我的湿度变量。(对不起,如果我把这个贴错了,这是我在这里的第一篇文章)
public class HeatIndexCalculator {
private int temperature;
private double humidity;
private double heatIndex;
public double calculateHeatIndex(int currentTemp, double currentHumidity){
temperature = currentTemp;
humidity = (currentHumidity/100.0);
heatIndex=(-42.379)+(2.04901523*temperature)+10.14333127*humidity+
-0.22475541*temperature*humidity+
-0.00683783*temperature*temperature+
-0.05481717*humidity*humidity+
0.00122874*temperature*temperature*humidity+
0.00085282*temperature*humidity*humidity+
-0.00000199*temperature*temperature*humidity*humidity;
下面是我尝试调用该方法时
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
int x;
double y,z;
HeatIndexCalculator HeatC = new HeatIndexCalculator();
System.out.println("Please enter a temperature in degrees Fahrenheit");
x = input.nextInt();
System.out.println("Please enter the current humidity as a percenage");
y = input.nextDouble();
z = HeatC.calculateHeatIndex(x, y);
HeatC.printHeatIndex(x, y, z);
}