Exercise02_17

 1 import javax.swing.JOptionPane; 
 2 public class FrostTemperature {
 3     public static void main(String[] args){
 4         double twc,ta,v;
 5         String number;
 6         number = JOptionPane.showInputDialog(null,"Enter the temperature in Fahrenheit between -58F and 41F");
 7         ta = Double.parseDouble(number);
 8         number = JOptionPane.showInputDialog(null,"Enter the wind speed (>= 2) in miles per hour:");
 9         v = Double.parseDouble(number);
10         twc = 35.74 + 0.6215*ta - 35.75*Math.pow(v,0.16) + 0.4275*ta*Math.pow(v, 0.16);
11         int messageType=JOptionPane.INFORMATION_MESSAGE;
12         String message="The wind chill index is " + twc;
13         JOptionPane.showMessageDialog(null,message,"result",messageType);
14     }
15 }
原文地址:https://www.cnblogs.com/cherrydream/p/9800708.html