Question
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
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
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 at or below 50 degrees Fahrenheit and wind speeds at or 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, an error message should be printed and the program will exit (do not re-prompt the user for a correct value).
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.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started