Category : Science and Education
Archive   : HOT_COLD.ZIP
Filename : HOT_COLD.BAS

 
Output of file : HOT_COLD.BAS contained in archive : HOT_COLD.ZIP



CLS
PRINT:PRINT
color 3,1:cls
START:
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:"
LOCATE 15,27:PRINT USING"###.##";HI;:PRINT" Degrees Faharenheit.
REDO:
LOCATE 18,31:INPUT"RUN ANOTHER (Y/N)";ANS$
IF ANS$="Y" OR ANS$="y" THEN GOTO MENU ELSE CLS:END

2:
WNDCHILL:
T=0:V=0
CLS: LOCATE 14,20:INPUT"TEMPERATURE (DEGREES F)"; T
IF T>45 THEN COLOR 31:PRINT:PRINT" ERROR!! YOU MUST ENTER A VALID VALUE! ":FOR X=1 TO 10000:NEXT X:COLOR 3,1:GOTO MENU
PRINT:PRINT TAB(20); :INPUT"WIND VELOCITY (MPH()";V
IF V<=3 THEN COLOR 31:PRINT:PRINT" ERROR!! YOU MUST ENTER A VALID VALUE! ":FOR X=1 TO 10000:NEXT X:COLOR 3,1:GOTO MENU

WC=((10.45+(6.686112*SQR(V))-(.447041*V))/22.034*(T-91.4))+91.4
PRINT:PRINT TAB(15); "WIND CHILL = "; USING"##.##";WC;:PRINT " DEGREES FAHRENHEIT."
PRINT:PRINT TAB(15)"WISH TO ENTER ANOTHER (Y/N)";:INPUT ANS$
IF ANS$="Y" OR ANS$="y" THEN GOTO MENU ELSE CLS:END