码迷,mamicode.com
首页 > 其他好文 > 详细

HW3.20

时间:2016-08-12 19:48:47      阅读:144      评论:0      收藏:0      [点我收藏+]

标签:

技术分享

 

 1 import java.util.Scanner;
 2 
 3 public class Solution
 4 {
 5     public static void main(String[] args)
 6     {
 7         Scanner input = new Scanner(System.in);
 8 
 9         System.out.print("Enter the temperature in Fahrenheit: ");
10         double temperature = input.nextDouble();
11 
12         System.out.print("Enter the wind speed miles per hour: ");
13         double windSpeed = input.nextDouble();
14 
15         input.close();
16 
17         if(temperature >= -58 && temperature <= 41 && windSpeed >= 2)
18         {
19             double windChillIndex = 35.74 + 0.6215 * temperature - 35.75 * Math.pow(windSpeed, 0.16) 
20             + 0.4275 * temperature * Math.pow(windSpeed, 0.16);
21             System.out.println("The wind chill index is " + windChillIndex);
22         }
23         else
24             System.out.println("The input value is invalid");
25     }
26 }

 

HW3.20

标签:

原文地址:http://www.cnblogs.com/wood-python/p/5765935.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!