首页 > 试题广场 >

(科学:风寒温度)外面到底有多冷?只有温度是不足以提供答案

[问答题]
 (科学:风寒温度)外面到底有多冷?只有温度是不足以提供答案的,包括风速、相对湿度以 及阳光等其他的因索在确定室外是否寒冷方面都起了很重要的作用。200丨年,国家气象服务 (NWS)利用温度和风速计算新的风寒温度,来衡量寒冷程度。计算公式如下所示:
 
这里的ta是室外的温度,以华氏摄氏度为单位,而 v 是速度,以每小时英里数为单位。twc 是风寒温度。该公式不适用于风速低于 2mph, 或温度在-58以T下或 41 T以上的情况。 编写程序,提示用户输入在-58 F和 41F 之间的度数,同时大于或等于2的风速,然后显 示风寒温度。使用Math.pow(a.b)来计算v0.16。下面是一个运行示例:


 
import java.util.Scanner;
public class NKTest {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
//        输入室外温度
        System.out.println("Enter the temperature in Fahrenheit between -58°F and 41F°");
        double temperature = sc.nextDouble();
//        输入风速
        System.out.print("Enter the wind speed (>=2) in miles per hour:");
        double windSpeed = sc.nextDouble();
        sc.close();
//        使用公式计算寒冷程度
        double index = 35.74 + 0.6215 * temperature - 
                35.75 * Math.pow(windSpeed, 0.16)
                + 0.4275 * temperature * Math.pow(windSpeed, 0.16);
//        输出并保留五位小数
        System.out.println("The wind chill index is " + String.format("%.5f", index));

    }
}
编辑于 2021-05-02 18:40:45 回复(0)
package ab;
import java.util.Scanner;
public class As {
    public static void main(String[] args) {
        // TODO 自动生成的方法存根
         double t1,v;
         System.out.print("Enter the temperature in Fahrenheit between -58F and 41F:");
         Scanner in=new Scanner(System.in);
         t1=in.nextDouble();
         System.out.print("Enter the wind speed (>=2) in miles per hour:");
         Scanner s=new Scanner(System.in);
         v=in.nextDouble();
         double t2;
         t2=35.74+0.6215*t1-35.75*Math.pow(v, 0.16)+0.4275*t1*Math.pow(v,0.16);
         System.out.print("The wind chill is"+" "+String.format("%.5f",t2));
    }

}

发表于 2021-04-07 11:07:12 回复(0)