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

Wind Chill Factor1 Write a program that inputs the current temperature, the temp

ID: 3759898 • Letter: W

Question

Wind Chill Factor1
Write a program that inputs the current temperature, the temperature scale (c for Celsius or f for
Fahrenheit), and the wind speed in miles per hour, then calculates and outputs the wind chill factor
using the same temperature scale as that which was entered as input. Temperature and wind speed may
include decimal places. Temperature output should use one decimal place. You may assume that input
will be valid and the scale will be entered in lowercase.
Meteorologists use the following formula to compute the wind chill factor, W:
W=35.74+0.6215T35.75V0.16+0.4275T V0.16
where V is the wind speed in miles per hour and T is the temperature in degrees Fahrenheit2
.
The formulas to convert between Celsius and Fahrenheit are:
C=
5
9
(F32) and F=
9
5
C+32
In implementing your solution, include at least these three functions:
• ctof: A function that takes a Celsius temperature and returns its Fahrenheit equivalent.
• ftoc: A function that takes a Fahrenheit temperature and returns its Celsius equivalent.
• windchill: A function that takes a temperature in Fahrenheit degrees and a wind speed in miles
per hour (both double), and returns the wind chill factor in Fahrenheit degrees. (You may, at
your option, include a third parameter for the temperature scale, in which case the temperature
is provided in the given scale, and the wind chill factor returned is in that same scale.)
Your main function should prompt for the required information, make use of the functions above to
calculate a result, then output the result.
Use the pow function from the cmath library where appropriate.

Explanation / Answer

#include<iostream.h>
#include<conio.h>
double ctof(double cc)
{
   double c=(5/9)*(cc-32);
   return c;
}
double ftoc(double cc)
{
   double c=(5/9)*(cc+32);
   return c;
}

double windchill(double ct, double V,char s)
{
   double T,cf;
   if(s=='c')
       T=ctof(ct);
   else
       cf=ftoc(ct);

   double wcf=35.74+0.6215*T-35.75*V*0.16+0.4275*T*V*0.16;
   return wcf;
}
void main()
{
   double ct,ws;
   char s;

   cout<<"Enter current Tempreture";
   cin>>ct;

   cout<<"Enter tempreture scale";
   cin>>s;

   cout<<"Enter wind speed";
   cin>>ws;

   double r=windchill(ct,ws,s);
   cout<<"Wind chill factor is ="<<r;
   getch();
}
      

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