题目
题目描述
*2.17(科学:风寒温度)外面有多冷?twc=35.74+0.6215ta-35.75v0.16+0.4275tav0.16,输入度数(-58到41)、风速(大于等于2)显示风寒温度
等式简化:t0 = 35.74 + 0.6125 * t1 - 35.75 * v + 0.4275 * t1 * v
v是速度(需要接收到后转换)
t0为风寒温度
t1为室外温度
破题
强制带入
运行示例
Enter the temperature in Fahrenheit between -58°F and 41°F: 5.3
Enter the wind speed (>=2) in miles per hour: 6
The wind chill index is -5.56707
代码
import java.util.Scanner;
public class Test2_17 {
public static void main(String[] args) {
// 等式简化为:t0 = 35.74 + 0.6125 * t1 - 35.75 * v + 0.4275 * t1 * v
// 接收t1 v
Scanner input = new Scanner(System.in);
System.out.println("Enter the temperature in Fahrenheit between -58°F and 41°F: ");
double t1 = input.nextDouble();
System.out.println("Enter the wind speed (>=2) in miles per hour: ");
double v0 = input.nextDouble();
double v = Math.pow(v0, 0.16);
// 计算t0
double t0 = 35.74 + 0.6125 * t1 - 35.75 * v + 0.4275 * t1 * v;
// 输出
System.out.println("The wind chill index is "+t0);
}
}
难点
题目的提炼、简化,特别是公式的简化