In November 2001 the National Weather Service implemented the new wind chill ind
ID: 3798935 • Letter: I
Question
In November 2001 the National Weather Service implemented the new wind chill index, used by the U.S. and Canadian weather services, which is determined by iterating a model of skin temperature under various wind speeds and temperatures. The model used standard engineering correlations of wind speed and heat transfer rate. Heat transfer was calculated for a bare face in wind, facing the wind, while walking into it at 1.4 meters per second (3.1 mph). The model corrects the officially measured wind speed to the wind speed at face height, assuming the person is in an open field. The results of this model may be approximated, to within one degree, from the equivalent formula in US customary units: T_wc = 35.74 + 0.6215 T_a - 35.75V^0.16 + 0.4275 T_a V^0.16 where T_wc and T_a are measured in degree F, and v_in mph. T_a represents actual temperature and V is wind speed, so, for example, if the actual temperature is 22 degrees F and the wind speed is 15 mph. the wind chill would be 8.8. Write a program which varies wind speed from 5 to 45 by 5 and temperature from -5 to 50 by 5 and displays a table of wind chill values similar to:Explanation / Answer
/**
C ++ program that calculats the wind chill of given actual
temperature and wind speed and print to console.
*/
//program.cpp
//header files
#include<iostream>
#include<iomanip>
#include<cmath>
using namespace std;
//main funciton
int main()
{
//intializeation of variables
double twc=0;
int stepSize=5;
double ta=-5.0;
int windSpeed=5;
//print heading
cout<<"Temp:--------------Wind Speed--------------------"<<endl;
cout<<right<<setw(10)<<windSpeed;
for(windSpeed=10;windSpeed<=45;windSpeed=windSpeed+stepSize)
cout<<setw(8)<<windSpeed;
cout<<endl;
//Run while loop for actual temperature util less than
//or equal to 50
while(ta<=50)
{
cout<<left<<setw(3)<<ta;
//Run for loop for wind speed until less than
//or equal to 45
for(windSpeed=5;windSpeed<=45;windSpeed=windSpeed+stepSize)
{
//calculate wind chill
twc=35.74+0.6215*ta-35.75*pow((double)windSpeed,0.16)
+0.4275*ta*pow((double)windSpeed,0.16);
//print to console
//right for right alignment with three precision values
cout<<right<<setprecision(3)<<setw(8)<<twc;
}
//increment ta by 5
ta+=5;
cout<<endl;
}
system("pause");
return 0;
}
Sample OutputL
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.