Difference between revisions of "Wind Chill"
From CompSciWiki
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= | + | |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
IntroductionIn 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.
|
---|
Step 1: Get inputs/outputs needed to solve the problem
You will need the following in order to solve this problem.
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.