This is the syntax highlighted version of WindChill.java.
/*************************************************************************
* Compilation: javac WindChill.java
* Execution: java WindChill T V
*
* Given the temperature T (in Fahrenheit) and the wind speed V
* (in miles per hour), compute the wind chill W using the formula
* from the National Weather Service
*
* W = 35.74 + 0.6215*T + (0.4275*T - 35.75) * V ^ 0.16
*
* Reference: http://www.nws.noaa.gov/om/windchill/index.shtml
*
*************************************************************************/
public class WindChill {
public static void main(String[] args) {
double T = Double.parseDouble(args[0]);
double V = Double.parseDouble(args[1]);
double W = 35.74 + 0.6215*T + (0.4275*T - 35.75) * Math.pow(V, 0.16);
System.out.println("Temperature = " + T);
System.out.println("Wind speed = " + V);
System.out.println("Wind chill = " + W);
}
}
Last updated: Wed Feb 11 18:07:23 EST 2004
.
Copyright © 2004, Robert Sedgewick and Kevin Wayne.