Write a Java program that calculates the wind chill temperature W given the current temperature t and the wind velocity v. The current temperature and the wind velocity should be entered by the user. The formula the National Weather Service uses to calculate wind chill is:
W = 35.74 + 0.6215t + (0.4275t - 35.75)v0.16
Here is an example interaction with wind chill program. Note that the answer is printed rounded to one decimal place.
Enter temperture (F): 32 Enter wind velocity (MPH): 10 The wind chill for 32.0 degrees with a wind velocity of 10.0 MPH is 23.7 degrees.
Math.pow(x,y)
. For example, to calculate
(3.14159)7 we can write Math.pow(3.14159,7)
.
To calculate (a+b)(c+d) we write
Math.pow(a+b,c+d)
assuming that a, b, c, d
were variables that were already declared in the program.
Math.rint()
rounds a real
number (double) to the closest integer.
Program.java
in a folder named HW1
in your personal folder on the T:
drive (not the
P:
drive).