ITPub博客

首页 > 应用开发 > Javascript > 计算风寒湿度(要求风速必须>=2,华氏度在-58度至41度之间)

计算风寒湿度(要求风速必须>=2,华氏度在-58度至41度之间)

原创 Javascript 作者:bug不存在的 时间:2021-10-08 17:22:09 0 删除 编辑

package homeWork;

import java.util.Scanner;


public class T0822 {

   

    public static void main(String[] args) {   

            Scanner input = new Scanner(System.in);

            //prompt the user to enter the fahrenheit and wind chill index

            System.out.print("Enter the tempreture in fahrenheit between -58 °F and 41 °F:");

            double tempreture = input.nextDouble();

            

            System.out.print("Enter the wind speed miles per hour(must be greater than or equal to 2:");

            double windChill = input.nextDouble();

            

            if(tempreture >= (-58) && tempreture <= 41 && windChill >= 2) {

                  //T是风寒温度

                  double T = 35.74 + 0.6215 * Math.pow(windChill, 0.16) + 0.4275 * Math.pow(tempreture,0.16);

                  System.out.println("The wind chill index is " + T);           

            }

            else

                System.out.println("Can't run");

            

            input.close();                    

        }

}


来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/70007877/viewspace-2794979/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2021-10-08

  • 博文量
    23
  • 访问量
    12357