Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

In cold weather, meteorologists report an index called the wind chill factor, wh

ID: 3926281 • Letter: I

Question

In cold weather, meteorologists report an index called the wind chill factor, which 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. Wind chill may be approximated by the following formula, w = 33 -(10 Squareroot u - u + 10.5) (33 - t)/23.1 where u = wind speed in m/sec t = temperature in degrees Celsius: t leftarrow 10 W = wind chill index (in degrees Celsius) Write a function that returns the wind chill 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 library and compare the wind chill index you calculate with the result reported in the newspaper.

Explanation / Answer

Please follow the code and comments for description :

CODE :

#include <iostream> // required header files for the code
#include <cmath>

using namespace std;

float windChillIndex (float temperature, float windspeed) { // function that returns the wind index for the given temperature and speed
float windindex = 35.74f + 0.6215f * temperature; // initialising the wind index
windindex -= 35.75f * pow(windspeed, 0.16f); // calculating the index values
windindex += 0.4275f * temperature * pow(windspeed, 0.16f);
return windindex; // returning the index result value
}

int main() // driver method
{
cout << "Welcome to Wind Chill Index Calculator.!" << endl; // prompt for the user about the code
cout << "Enter the Temperature (in Celsius <= 10) : " << endl; // prompt to enter the data
float temp = 0;
cin >> temp; // getting the data
if(temp < 0 || temp > 10){ // checking for the entered data temperature
cout << "Invalid Temperature.!" << endl;
exit(0); // exiting the code
}
cout << "Enter the Wind Speed (in m/sec) : " << endl; // prompt to enter the speed of the wind
float windSpeed = 0;
cin >> windSpeed; // getting the data

float windIndex = windChillIndex (temp, windSpeed); // calculating the result by calling the function
cout << "The Resultant Wind Chill Index is : " << windIndex << " C"<< endl; // printing the result in celsius format

return 0;
}

OUTPUT :

Welcome to Wind Chill Index Calculator.!
Enter the Temperature (in Celsius <= 10) :
10
Enter the Wind Speed (in m/sec) :
50
The Resultant Wind Chill Index is : -16.9024 C


Hope this is helpful.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote