PRINT"Weather is always a facinating natural phenomenon. We hear about Heat Index, butrarely have an opportunity to calculate it."
PRINT
PRINT"So, I wrote the following program for calculating the heat index based on the Fahrenheit temperature and the relative humidity, and wind chill calculations based on temperature and wind velocity."
PRINT
PRINT"The formula for heat index was obtained from the Federal Weather Forecasting Office in Atlanta Ga. The accuracy was given as +- 1.3 degrees."
PRINT:PRINT"The formula for wind chill was obtained from a non-copyrighted printed program."
PRINT:PRINT:PRINT" Harold Grumann, July 1993
LOCATE 18,30:INPUT"PRESS ANY KEY WHEN READY.";A$
MENU:
CLS:LOCATE 12,10
PRINT"1) HEAT INDEX (for temps over 70 deg and humidity over 30%)"
LOCATE 13,10: PRINT"2) WIND CHILL (for temps under 45 deg and wind over 3 MPH)"
PRINT " (Values outside these ranges are meaningless.)"
PRINT:PRINT TAB(26) "Select 1 or 2";:input;S
if S <1 or S >2 then cls: goto menu
ON S GOTO 1,2
1:
INPUTTING:
CLS
LOCATE 10,20
INPUT"ENTER THE TEMPERATURE (DEG F)";T
IF T<70 THEN COLOR 31:PRINT:PRINT" ERROR!! YOU MUST ENTER A VALID VALUE.":FOR X = 1 TO 10000:NEXT X:COLOR 3,1:GOTO MENU
LOCATE 12,20
INPUT"ENTER THE RELATIVE HUMIDITY (%)";RH
IF RH<30 THEN COLOR 31:PRINT:PRINT" ERROR!! YOU MUST ENTER A VALID VALUE.":FOR X=1 TO 10000:NEXT X:COLOR 3,1:GOTO MENU
CALCULATE:
CLS
HI = -42.379 + 2.04901523# * T + 10.14333127# * RH - .22475541# * T * RH - 6.83783E-03 * T ^ 2 - 5.581717E-02 * RH ^ 2 + 1.22874E-03 * T ^ 2 * RH + 8.5282E-04 * T * RH ^ 2 - 1.99E-06 * T ^ 2 * RH ^ 2
'In which T= Fahrenheit temperture and RH= Relative Humidity (%).
DISPLAY:
CLS:LOCATE 12,1
PRINT "The HEAT INDEX for";T;: PRINT"Degrees Fahrenheit and";RH;:PRINT "% Relative Humidity is:"