This program calculates the wind chill temperature in degrees Fahrenheit using the traditional Siple-Passel formula. It prompts the user for an ambient temperature in Fahrenheit and a wind speed in miles per hour, then applies the formula WC = 0.0817 × (3.71 × √S + 5.81 − 0.25 × S) × (T − 91.4) + 91.4. A guard clause at line 80 handles the meteorological convention that wind chill is undefined below 4 mph, simply returning the ambient temperature in that case. After displaying the result with a long PAUSE of approximately 40 seconds, the screen clears and the program restarts automatically.
Program Analysis
Program Structure
The program follows a simple linear input–calculate–output loop across three phases:
- Input (lines 10–60): Prompts for temperature
Tand wind speedS, echoing each value back after entry. - Calculation (lines 70–80): Applies the wind chill formula and handles the low-wind edge case.
- Output and restart (lines 90–120): Displays the result, pauses, clears the screen, and loops via
RUN.
Lines 9998–9999 are utility lines outside normal execution: SAVE "WINDCHIL%L" saves the program (the %L represents an inverse-video ‘L’ in the filename), and the trailing RUN restarts immediately after loading.
Wind Chill Formula
Line 70 implements the Siple-Passel empirical wind chill formula:
WC = 0.0817 × (3.71 × S^0.5 + 5.81 − 0.25 × S) × (T − 91.4) + 91.4
This is the classic pre-2001 formula expressing wind chill in degrees Fahrenheit, where S is wind speed in mph and T is air temperature in Fahrenheit. The constant 91.4°F represents normal skin temperature. The **.5 exponentiation is used to compute the square root of wind speed rather than a dedicated SQR function, which is mathematically equivalent.
Notable Techniques
- Tab-comma formatting: The double commas (
,,) inPRINTstatements at lines 10, 40, and 90 advance the print position to the third print zone, centering the prompts on the display. - Input echo: Lines 30 and 60 print back
TandSrespectively. On this platform,INPUTaccepts values without leaving them visibly confirmed on screen in all modes, so this serves as user feedback. - Long PAUSE for display:
PAUSE 40000at line 100 holds the result on screen for roughly 40 seconds (at 50 Hz) before auto-clearing, avoiding the need for a keypress to continue. - RUN as loop: Using
RUNat line 120 rather thanGO TO 10restarts from scratch, clearing all variables — a clean but slightly heavier-weight approach to looping.
Edge Case Handling
Line 80 checks whether wind speed is below 4 mph:
80 IF S<4 THEN LET WC=T
This correctly replaces the formula result with the ambient temperature, as the Siple-Passel model is not valid at very low wind speeds (the formula can produce values higher than the ambient temperature at near-zero wind, which is physically nonsensical).
Variable Summary
| Variable | Purpose |
|---|---|
T | Ambient temperature in degrees Fahrenheit |
S | Wind speed in miles per hour |
WC | Calculated wind chill temperature in degrees Fahrenheit |
Content
Source Code
10 PRINT ,,"TEMPERATURE (F)? ";
20 INPUT T
30 PRINT T
40 PRINT ,,"WIND SPEED (M/HR)? ";
50 INPUT S
60 PRINT S
70 LET WC=.0817*(3.71*S**.5+5.81-.25*S)*(T-91.4)+91.4
80 IF S<4 THEN LET WC=T
90 PRINT ,,"WIND CHILL = ";WC;" DEGREES."
100 PAUSE 40000
110 CLS
120 RUN
9998 SAVE "WINDCHIL%L"
9999 RUN
Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.
