Question: write a programm that promote users to enter two numbers and make a calculation and display a result Your program will prompt the user to
write a programm that promote users to enter two numbers and make a calculation and display a result 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 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, 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()
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) 0.0 0.0 (Note - program should exit with an error statement immediately after the wind speed is entered) 0.0 15.9 0 15.9 -40 10 8 4 (Result: 0.4. Tests the leading 0 for values between -1.0 and 1.0)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
