Wind chill factor is the felt air temperature on exposed skin due to wind .
The wind chill temperature is always lower than the air temperature, and is
calculated as per the following formula :
wcf = 35.74 +0.6215t + (0.4275t - 35.75) * v0.16
Write a program in Java to receive values of temperature and wind velocity
and calculate wind chill factor.
Answers
A program in Java to receive values of temperature and wind velocity:
import java.util.Scanner;
public class CalcWindChillTemp {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
System.out.println("Enter outside temperature in Fahrenheit "
+ "(between -58 and 41 degrees):");
double temp = input.nextDouble();
System.out.println("Enter wind speed in miles per hour "
+ "(greater than or equal to 2 mph):");
double speed = input.nextDouble();
double wct = 35.74 + (0.6215 * temp) - (35.75
* Math.pow(speed, 0.16)) + (0.4275 * temp * Math.pow(speed, 0.16));
wct = (int) (wct * 100000) / 100000.0;
System.out.println("”Wind Chill Temperature = " + wct + "\n");
}
}