Write a program for a meteorologist that calculates the wind
Write a program for a meteorologist that calculates the wind chill factor and cloud base altitude for the inputs temperature in Fahrenheit, wind speed in mph, and the dew point in Fahrenheit. You must use four (4) functions in the solution: one for getting input, one to compute the wind chill, one to compute the cloud base, and one for the output. The output will be formatted exactly as shown below with the introduction as shown and notes as appropriate.
Use the cmath library for the power function…#include
The equation for approximating the wind chill factor in North America is: wc = 35.74 + 0.6215 Ta - 35.75V +0.16 + 0.4275 Ta V +0.16 Where Ta is the air temperature in Fahrenheit V is the wind speed in mph (consider pow(windSpeed, 0.16))
Also, wind chill temperature is defined only at or below 10? C (50 ? F), and wind speeds above 4.8 kilometers per hour (3.0 mph). The program must check this.
The cloud base in feet above ground level is determined by the “spread” which is the difference between the temperature and the dew point, and is calculated: cloudBase = temperature spread / 4.4 * 1000
Output screen captures and test data: I This program determines wind chill using temperatureI I in Fahrenheit and wind speed in mph, and computos I the cloud base using the dew point in Fahrenheit. Enter the temperature in degrees Fahrenheit: 2 Enter the wind speed in mph: 15 Enter the dew point in degrees Fahrenheit: 5 Temperature dind Speed De Point Wind Chill Cloud Base 20.0 dF 15.0 mph 5.0 dF 6.2 dF 3409.1 ftSolution
#include<iostream>
#include <math.h>
void input(double *temperature,double *windSpeed,double *duePoint);
void output(double *temperature,double *windSpeed,double *duePoint,double windChill,double cloudBase);
double computeWindChill(double *temperature,double *windSpeed);
double computeCloudBase(double *temperature,double *duePoint);
int main()
{
//Declare all variables
double *temperature= new double;
double *windSpeed= new double;
double *duePoint = new double;
double windChill = 0;
double cloudBase = 0;
//Get input
input(temperature,windSpeed,duePoint);
//Compute only if temperature is <=50 and windSpeed is >=3
if(*temperature<=50 && *windSpeed>=3) {
//Call computeWindChill method
windChill= computeWindChill(temperature,windSpeed);
}
//Call computeCloudBase method
cloudBase= computeCloudBase(temperature,duePoint);
//Print output
output(temperature,windSpeed,duePoint,windChill,cloudBase);
return 0;
}
//Method to get input
void input(double *temperature,double *windSpeed,double *duePoint)
{
cout<<\" ----------------------------------------------------------\ \";
cout<<\" | This program determines wind chill using temperature. |\ \";
cout<<\" | in Farenheit and wind speed in mph. and computes |\ \";
cout<<\" | the cloud base using the dew point in Farenheit. |\ \";
cout<<\" ----------------------------------------------------------\ \ \ \";
cout<<\"Enter the temperature in degrees Fahrenheit: \";
cin>>*temperature;
cout<<\"Enter the wind speed in mph: \";
cin>>*windSpeed;
cout<<\"Enter the dew point in degrees Fahrenheit: \";
cin>>*duePoint;
}
//Method to print output
void output(double *temperature,double *windSpeed,double *duePoint,double windChill,double cloudBase)
{
cout<<\"\ Temperature\\tWind Speed\\tDew Point\\tWind Chill\\tCloud Base\ \";
cout<<\"-----------------------------------------------------------------------------\ \";
if(*temperature<=50 && *windSpeed>=3)
{
cout<<*temperature<<\"\\t\\t\"<<*windSpeed<<\"\\t\\t\"<<*duePoint<<\"\\t\\t\"<<windChill<<\"\\t\\t\"<<cloudBase<<\"\ \";
}
else
{
cout<<*temperature<<\"\\t\\t\"<<*windSpeed<<\"\\t\\t\"<<*duePoint<<\"\\t\\t\"<<\"xxx\"<<\"\\t\\t\"<<cloudBase<<\"\ \";
cout<<\"\ xxx Temperature must be 50 degrees or less, and windspeed \ must be 3 mph or more to compute wind chill.\ \";
}
}
//Method to compute wind chill and return wind chill
double computeWindChill(double *temperature,double *windSpeed)
{
double windChill;
windChill = 35.74 + 0.6215 *(*temperature) - 35.75*(pow(*windSpeed,0.16))+ 0.4275*(*temperature)*(pow((*windSpeed),0.16));
//35.74 + 0.6215*(*temperature) - 35.75*(*windSpeed) +0.16 + 0.4275 *(*temperature)*(*windSpeed) +0.16;
return windChill;
}
//Method to compute cloud base
double computeCloudBase(double *temperature,double *duePoint)
{
double cloudBase;
cloudBase = (*temperature - *duePoint)/4.4 * 1000;
return cloudBase;
}

