Question
Create an HTML document which contains two text fields, a button, and a div. The first text field should be labeled Temperature, and the second
Create 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 doInputOutput() function windChill(tempF, speed)
The first function (doInputOutput) 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.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started