Question: please write following program in C. please carefully read the instruction. Your program will prompt the user to enter two values. The first value will

please write following program in C.
please carefully read the instruction.
Your program will prompt the user to enter two values. The first value will be a temperature in degrees Fahrenheit, and will be of type int. The second value will be the wind speed in miles per hour, and will be of type double. You will use the following formula to calculate the Wind Chill Index which will be of type double:
Twc = 35.74 + 0.6215Ta - 35.75V+0.16 + 0.4275TaV+0.16
Note that there are five constants in the above formula. You will use the pre-processing directive #define to express the first three constants: 35.74, 0.6215, and 35.75 (which will be named CONST_ONE, CONST_TWO, and CONST_THREE). You will use global constant declarations for the last two values: 0.16 and 0.4275 (which will be named EXPONENT and CONST_FOUR). The actual line(s) of code that calculates the wind chill will contain no digits.
Once you have calculated the Wind Chill Index, you will then display the temperature, wind speed and wind chill using descriptive statements such as:
Temperature: 38 degrees Fahrenheit
Wind Speed: 17.4 mph
Wind Chill Index: 28.6 degrees Fahrenheit
Floating point numbers should be output to one decimal place. Also, values of a magnitude less than 1 should display a leading 0 (ex. 0.7). Even though the temperature will be read as type int and wind speed will be read as a type double, the user may or may not enter values with a decimal point. In other words, expect the user to enter values such as 25, 25.0 and 25.35 for both temperature and wind speed.
Note that wind chill calculations only work correctly for temperatures below 50 degrees Fahrenheit and wind speeds above 3 mph. For this lab, you must check inputs to ensure that the values are within a proper range. If an improper value is entered (temperature is >= 50 or wind speed <= 3.0), an error message will be printed and the program will exit (do not re-prompt the user for a correct value). You may assume for error checking purposes, that only numerical values will be entered by the user.
For input, you must use the fgets()/sscanf() combination of Standard I/O functions. Do not use the scanf() or fscanf() functions. Although using scanf() for retrieving numerical data is convenient, it is problematic when used in conjunction with character string input. Therefore, it is best to get into the habit of using the fgets()/sscanf() combination exclusively.
Note from the sscanf() manpage that when reading a floating point value, if the data type of the variable that will receive the value is of type double, you must use "%lf" (long float) instead of "%f" (float) for your format string
Run the executable using at a minimum the following pairs of input samples (use the weather.gov link above to verify correct calculation results):
Temperature Wind Speed
32 10.0
32.0 10
32.5 10.0 (Note - the temperature should be treated as the integer 32)
-4 16.4
55 16 (Note - program should exit with an error statement before the wind speed can be entered)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!