Write an HTML document which contains two text fields, a button, and a div. The first text field should be labeled “Temperature”
, and the second should be labeled “Wind Speed”. The button should have the text “Wind Chill” written on it. Write two functions with these headers: function compute() function windChill(tempF, speed) The first function (compute) must be called from the onclick attribute of the button and must do the following: get a temperature from the first text field get a wind speed from the second text field call the second function (windChill) store the value returned by windChill in a variable output the value returned by windChill to the div for the user to see The second function (windChill) must take a temperature in Fahrenheit as a parameter take a wind speed in miles per hour as a parameter calculate the wind chill factor as a temperature in Fahrenheit return the wind chill factor in Fahrenheit In other words, the second function (windChill) must not gather any input from a user and must not output anything for a user to see. Instead it must calculate and return the result which makes this second function very reusable in other projects. The formula for computing the wind chill factor is f = 35.74 + 0.6215 t − 35.75 s0.16 + 0.4275 t s0.16 where f is the wind chill factor in Fahrenheit, t is the air temperature in Fahrenheit, and s is the wind speed in miles per hour at five feet above the ground.
I created a jsfiddle for this: https://jsfiddle.net/tonb/o7uv4cdm/26/
Explanation:
see jsfiddle.
The usual html and body tags are omitted for simplicity. For your stand-alone page you'll have to put them in, as well as additional tags for your inline scripting.