Computer Project #1 Solution
This assignment focuses on the design, implementation and testing of a Python program to display the wind chill temperature index under certain conditions (see below).
The deliverable for this assignment is the following file: proj01.py – your source code program
Be sure to use the specified file name and to submit it for grading via the handin system before the project deadline.
When air moves across exposed skin, humans perceive the temperature to be colder than the measured air temperature. The National Weather Service uses a formula to quantify that perception:
The NWS Wind Chill Temperature (WCT) index uses advances in science, technology, and computer modeling to provide an accurate, understandable, and useful formula for calculating the dangers from winter winds and freezing temperatures.
Additional information, including the formula for calculating the WCT index, is available at: http://www.nws.noaa.gov/om/winter/windchill.shtml
Your program will be logically subdivided into two parts.
1. For each of the following air temperature and wind speed measurements, your program will perform the appropriate calculations and display the corresponding wind chill temperature index:
• 15.0 degrees and 10 MPH
• 0.0 degrees and 20 MPH
• -15.0 degrees and 30 MPH
2. After calculating and displaying the wind chill temperature indices for the three pairs of measurements given above, your program will then:
• prompt the user to enter an air temperature measurement and accept a floating point value representing that measurement
• prompt the user to enter a wind speed measurement and accept a floating point value representing that measurement
• perform the appropriate calculations
• display the wind chill temperature index for those user-selected values
Note that all air temperature measurements are given in the Fahrenheit scale.
1. To clarify the project specifications, sample output is appended to the end of this document.
2. The input function is used to accept a response from the user. The function accepts a string (a sequence of characters between quotes) as a prompt to display to the user. It then waits until the user types a response (terminated by the user touching the Enter key). Finally, the function returns the user’s response as a string.
If the user’s response is supposed to be processed as a numeric value, the returned string must be converted into a number. When working with floating point values, a string is converted into a floating point number using the float function. The function accepts a string as its argument and returns the floating point number which the string represents. A typical interaction would be
something like: num_str = input( "Please enter a number: " ) num_float = float( num_str )
3. The print function is used to display any combination of variables, values and strings inthe output window. Each item to be displayed must be separated from another item by a comma.
All the items will be displayed together, followed by a new line. For example:
print( num_int, " times two is ", num_int*2 ) Three items will be displayed when the print function is called: the value of the variable
num_int, the string " times two is ", and the result of the calculation.
Assuming that the value of the variable num_int is 26, then the output will be:
26 times two is 52
4. Use the following formula to calculate the Wind Chill Temperature Index, assuming that
variables T, air temperature, and V, air_speed, have been assigned values:
𝑊𝐶𝑇 = 35.74 + 0.6215𝑇 − 35.75𝑉!.!" + 0.4275𝑇𝑉!.!"
(Edit on September 5: the original formula had an error. The formula is now correct.)
5. The file named number_input.py in the project directory contains a program which illustrates the use of some standard library functions.
• Solve the problem using pencil and paper first. You cannot write a program until you have figured out how to solve the problem. This first step can be done collaboratively with another student. However, once the discussion turns to Python specifics and the subsequent writing of Python, you must work on your own.
• Use Anaconda to create a new program. Use the required file name (proj01.py).
• Write a simple version of the program, e.g. one wind chill calculation without input. Run
the program and track down any errors.
• Use the handin system to turn in the first version of your program.
• Cycle through the steps to incrementally develop your program:
o Edit your program to add new capabilities.
o Run the program and fix any errors.
• Use the handin system to submit your final version.
You'll get a 335.9KB .ZIP file.