Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*******************************************************************************
- AUTHOR SECTION
- ENGR 200.06 DATE: 02/12/2017
- PROGRAM: #3 Author: Kevin Davis
- ********************************************************************************
- PROGRAM DESCRIPTION
- This program will calculate windchill and time to frostbite.
- DESCRIPTION OF VARIABLES
- NAME | TYPE | DESCRIPTION
- Chill | double | Wind Chill (Output)
- Frostbite | double | Time to frostbite (Output)
- Fahrenheit | double | Input temperature in degrees fahrenheit
- Wind | double | Input wind speed in miles per hour
- -----------------------------------------------------------------------------
- *******************************************************************************/
- /* Preprocessor directives */
- #include <stdio.h>
- #include <math.h>
- /* Main function */
- int main()
- {
- /* Declare variables */
- double Fahrenheit = 0;
- double Wind = 0;
- double Chill = 0;
- double Frostbite = 0;
- /* Input values */
- printf("********************************************\n");
- printf(" WIND CHILL CALCULATION \n\n");
- printf("Enter temperature in degrees Fahrenheit:");
- scanf("%lf", &Fahrenheit);
- printf("Enter wind speed in miles per hour :");
- scanf("%lf", &Wind);
- /* Compute Wind Chill */
- if (-45 <= Fahrenheit && 40>= Fahrenheit)
- {
- Chill = 35.74+(0.6215*Fahrenheit)-35.75*pow(Wind, 0.16)+0.4275*Fahrenheit*pow(Wind, 0.16);
- }
- else
- {
- printf("error! recheck input for temperature");
- return 0;
- }
- if(0 <= Wind && 60 >= Wind)
- {
- }else {
- printf("error! recheck input for wind speed");
- return 0;
- }
- if (Chill >= -35 && Chill <= -18)
- {
- Frostbite = 30;
- }
- else if (Chill >= -55 && Chill <= -36)
- {
- Frostbite = 10;
- }
- else if (Chill > -56)
- {
- Frostbite = 5;
- }
- else
- {
- printf("No frostbite concerns expected.");
- }
- /* Print output values */
- printf("\nRESULTS\n");
- printf("Temperature (degrees F): = %3.1f \n", Fahrenheit);
- printf("Wind speed (miles/hour): = %2.1f \n\n", Wind);
- printf("Wind Chill = %3.1f \n", Chill);
- printf("\nTIME TO FROSTBITE = %02d minutes \n", Frostbite);
- printf("********************************************\n");
- /* Exit the program */
- return 0;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement