In cold weather, meteorologists report an index called the windchill factor, tha
ID: 1766543 • Letter: I
Question
In cold weather, meteorologists report an index called the windchill factor, that takes into account the wind speed and the temperature. The index provides a measure of the chilling effect of wind at a given air temperature. Windchill may be approximated by the formula:
where
v = wind speed in m/sec
t = temperature in degrees Celsius: t <= 10
W= windchill index (in degrees Celsius)
Write a function that returns the windchill index. Your code should ensure that the restriction on the temperature is not violated. Look up some weather reports in back issues of a newspaper in your university library and compare the windchill index you calculate with the result reported in the newspaper.
Explanation / Answer
#include<iostream>
using namespace std;
//Function to compute the windchill
double computeWindChillFactor(double v,double t)
{
//To check whether maximum temperature condition vilates
if(t>10)
{
cout<<"The temperature is greater than allowed limit 10"<<endl;
return 0;
}
//compute and return the windchill factor
return 13.12 + (0.6215*t) - (11.37*v*0.16) + (0.3965*t*v*0.16);
}
int main(){
double result= computeWindChillFactor(10,5);
if(result==0)
cout<<"Error in temperature"<<endl;
else
cout<<"The windChill factore is " <<result<<endl;
system("pause");
return 0;
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.