Difference between revisions of "Wind Chill"

From CompSciWiki
Jump to: navigation, search
Line 9: Line 9:
 
|Body=
 
|Body=
  
== Step 1: ==
+
===[[Step 1: Get inputs/outputs needed to solve the problem ]]===
  
 +
You will need the following in order to solve this problem.
 +
<li>location - The location at which you want to calculate the windchill.
 +
<li>temperatue - The temperature of your desired location
 +
<li>windSpeed - The windSpeed at your desired location
 +
<li>input - Used to prompt the user for input
 +
<li>raw_input - Used to prompt the user for input
 +
<li>windChill - The calculated wind chill of your desired location
 +
 +
===[[Step 2: Write the program]]===
 +
 
{{CodeBlock
 
{{CodeBlock
|Code=Bla7;
+
|Code=#######################################################################
 +
#This program is used to calculate the wind chill of a desired location                                       
 +
 
 +
#input
 +
location = raw_input("What is the location?")
 +
temperature = input("What is the current temperature in Celsius?")
 +
windSpeed = input("What is the wind speed in kms per hour?")
 +
 
 +
#calculate windchill
 +
windchill = 13.12 + .6215*temperature- 11.37 * (windSpeed**0.16) + 0.3965 * temperature * (windSpeed ** 0.16)
 
}}
 
}}
 +
 +
===[[Step 3: Display the output of the program]]===
 +
 +
{{OutputBlock
 +
|Code=
 +
Location: Winnipeg
 +
Current Temperature: -10.0 Celsius
 +
Wind Speed: 30.0 km/h
 +
Temperature with Windchill: -19.52049803338773
 +
Programmed by A. Student
 +
**End of Program**
 +
}}
 +
 +
===[[Step 4: Contrast with Calculating Area in program a day example]]===
 +
 +
This Python program performs exactly the same function as the Java Calculate area program in Program a Day.
 +
But, there only some slight differences as shown below.
 +
 
}}
 
}}

Revision as of 21:43, 3 April 2012

COMP 1010 Home > Back to Extra Labs

Introduction

In Winnipeg , it is noted that wind can make the air temperature even much colder. Write a program that will uses input to read in an air temperature and a wind speed. Then use the formula below to calculate and output the windchill.

<math>T_{wc}=13.12 + 0.6215 T_a-11.37 V^{0.16} + 0.3965 T_a V^{0.16}\,\!</math>
where <math>T_{wc}\,\!</math> is the wind chill index based on the Celsius scale, <math>T_a\,\!</math> is the air temperature in °C, and <math>V\,\!</math> is the air speed in km/h.
Equation taken from Wikipedia which cites http://www.msc.ec.gc.ca/education/windchill/science_equations_e.cfm

Step 1: Get inputs/outputs needed to solve the problem

You will need the following in order to solve this problem.

  • location - The location at which you want to calculate the windchill.
  • temperatue - The temperature of your desired location
  • windSpeed - The windSpeed at your desired location
  • input - Used to prompt the user for input
  • raw_input - Used to prompt the user for input
  • windChill - The calculated wind chill of your desired location

    Step 2: Write the program

     #######################################################################
    #This program is used to calculate the wind chill of a desired location                                        
    
    #input
    location = raw_input("What is the location?")
    temperature = input("What is the current temperature in Celsius?")
    windSpeed = input("What is the wind speed in kms per hour?")
    
    #calculate windchill
    windchill = 13.12 + .6215*temperature- 11.37 * (windSpeed**0.16) + 0.3965 * temperature * (windSpeed ** 0.16) 

    Step 3: Display the output of the program

     Location: Winnipeg
    Current Temperature: -10.0 Celsius
    Wind Speed: 30.0 km/h
    Temperature with Windchill: -19.52049803338773
    Programmed by A. Student
    **End of Program** 

    Step 4: Contrast with Calculating Area in program a day example

    This Python program performs exactly the same function as the Java Calculate area program in Program a Day.

    But, there only some slight differences as shown below.