Wind Chill Factor (WCF) or Wind Chill Index (WCI) is a meteorological concept that quantifies the cooling effect of the wind on the perceived temperature. It represents the apparent temperature felt by the human body when exposed to both cold temperatures and wind. In essence, the Wind Chill Factor takes into account not only the actual air temperature but also the impact of wind speed on the rate of heat loss from the body.
Examples:
Input: temperature=50, windSpeed=100
Output: 62
Explanation: 13.12 + 0.6215 * (50) – 11.37 * (100)^0.16 + 0.3965 * (50) *(100)^0.16Input: temperature=25, windSpeed=120
Output: 26
Explanation: 13.12 + 0.6215 * (25) – 11.37 * (120)^0.16 + 0.3965 * (25) *(120)^0.16
Formula:
WCI = 13.12 + 0.6215 * (temperature) – 11.37 * (windSpeed)^0.16 + 0.3965 * (temperature) *(windSpeed)^0.16
Step-by-step algorithm:
- Define a function, say calculateWCI that takes two parameters – temperature and windSpeed – and calculates the Wind Chill Index using the above formula.
- Calculate the Wind Chill Index using the calculateWCI function and round off the result to the nearest integer.
Below is the implementation of the approach:
#include <iostream> #include <cmath> // Function to calculate Wind Chill Index (WCI) double calculateWCI( double temperature, double windSpeed) {
// Calculating Wind Chill Index (Twc)
double wci = 13.12 + 0.6215 * temperature - 11.37 * pow (windSpeed, 0.16) +
0.3965 * temperature * pow (windSpeed, 0.16);
return wci;
} int main() {
// Taking the Air Temperature (Ta)
double temperature = 50;
// Taking the Wind Speed (v)
double windSpeed = 100;
// Displaying the Wind Chill Index
std::cout << "The Wind Chill Index is " << static_cast < int >(round(calculateWCI(temperature, windSpeed))) << std::endl;
return 0;
} |
public class WindChillIndex {
// Function to calculate Wind Chill Index (WCI)
static double calculateWCI( double temperature, double windSpeed) {
// Calculating Wind Chill Index (Twc)
double wci = 13.12 + 0.6215 * temperature - 11.37 * Math.pow(windSpeed, 0.16 ) +
0.3965 * temperature * Math.pow(windSpeed, 0.16 );
return wci;
}
public static void main(String[] args) {
// Taking the Air Temperature (Ta)
double temperature = 50 ;
// Taking the Wind Speed (v)
double windSpeed = 100 ;
// Displaying the Wind Chill Index
System.out.println( "The Wind Chill Index is " + Math.round(calculateWCI(temperature, windSpeed)));
}
} |
import math
# Function to calculate Wind Chill Index (WCI) def calculate_wci(temperature, wind_speed):
# Calculating Wind Chill Index (Twc)
wci = 13.12 + 0.6215 * temperature - 11.37 * math. pow (wind_speed, 0.16 ) + \
0.3965 * temperature * math. pow (wind_speed, 0.16 )
return wci
def main():
# Taking the Air Temperature (Ta)
temperature = 50
# Taking the Wind Speed (v)
wind_speed = 100
# Displaying the Wind Chill Index
print ( "The Wind Chill Index is {}" . format ( round (calculate_wci(temperature, wind_speed))))
if __name__ = = "__main__" :
main()
|
using System;
class Program
{ // Function to calculate Wind Chill Index (WCI)
static double CalculateWCI( double temperature, double windSpeed)
{
// Calculating Wind Chill Index (Twc)
double wci = 13.12 + 0.6215 * temperature - 11.37 * Math.Pow(windSpeed, 0.16) +
0.3965 * temperature * Math.Pow(windSpeed, 0.16);
return wci;
}
static void Main()
{
// Taking the Air Temperature (Ta)
double temperature = 50;
// Taking the Wind Speed (v)
double windSpeed = 100;
// Displaying the Wind Chill Index
Console.WriteLine($ "The Wind Chill Index is {Convert.ToInt32(Math.Round(CalculateWCI(temperature, windSpeed)))}" );
}
} |
// Function to calculate Wind Chill Index (WCI) function calculateWCI(temperature, windSpeed) {
// Calculating Wind Chill Index (Twc)
let wci = 13.12 + 0.6215 * temperature - 11.37 * Math.pow(windSpeed, 0.16) +
0.3965 * temperature * Math.pow(windSpeed, 0.16);
return wci;
} // Main function function main() {
// Taking the Air Temperature (Ta)
let temperature = 50;
// Taking the Wind Speed (v)
let windSpeed = 100;
// Displaying the Wind Chill Index
console.log( "The Wind Chill Index is " + Math.round(calculateWCI(temperature, windSpeed)));
} // Call the main function main(); |
The Wind Chill Index is 62
Time Complexity: O(1)
Auxiliary Space: O(1)
Related Article: Calculating Wind Chill Factor(WCF) or Wind Chill Index(WCI) in Python