home *** CD-ROM | disk | FTP | other *** search
- 10 DEFDBL A,K,X:DEFINT J,M,N,T:DIM A(20),K(20):T=7
- 20 PRINT CHR$(26):REM CLEAR SCREEN
- 30 PRINT" *** MEASURE ***":PRINT:PRINT
- 31 REM Written by JIM SCHENKEL 415/928-4445. MBASIC
- 32 REM version 7/11/81 translated from original North
- 33 REM Star Basic version donated to NorthStar Users'
- 34 REM Group library in 1978. NSBASIC uses BCD math.
- 35 REM MBASIC doesn't, but double precision calculation
- 36 REM should give accurate results to 6 places as printed.
- 37 REM Data is from CRC HANDBOOK OF CHEMISTRY &
- 38 REM PHYSICS (58th ed., 1978). Good to 8 places.
- 39 REM Comments welcome.
- 40 PRINT"Choose the number of the type of measurement involved"
- 50 PRINT:RESTORE 380:FOR J=1 TO T:READ A$:PRINT J;A$:NEXT
- 60 PRINT:INPUT M
- 70 IF M<1 OR M>7 OR INT(M)<>ABS(M) THEN 40
- 80 PRINT CHR$(26):PRINT"Choose the number of the units"
- 90 PRINT"you wish to have converted"
- 100 GOSUB 740:N1=0
- 110 READ A$:IF A$="" THEN 130
- 120 N1=N1+1:PRINT N1;A$:GOTO 110
- 130 PRINT:INPUT N
- 140 IF N<=N1 AND N>=1 AND INT(N)=ABS(N) THEN 160
- 150 PRINT"Sorry, try again":GOTO 100
- 160 GOSUB 740:FOR J=1 TO N:READ A$:NEXT:PRINT
- 170 PRINT"How many ";A$;:INPUT X:GOSUB 750:IF M=7 THEN 320
- 180 FOR I=1 TO N1-1:READ R:K(I)=R:NEXT
- 190 IF N<>1 THEN 210
- 200 FOR J=2 TO N1:A(J)=X/K(J-1):NEXT:GOTO 250
- 210 A(1)=X*K(N-1):FOR J=2 TO N1
- 220 IF J=N THEN 240
- 230 A(J)=A(1)/K(J-1)
- 240 NEXT J
- 250 FOR J=1 TO N:READ A$:NEXT
- 260 PRINT:PRINT X;" ";A$;" is equivalent to:":GOSUB 740
- 270 FOR I=1 TO N1:READ A$:IF I=N THEN 290
- 278 REM O! in line 280 changes the calculated result to
- 279 REM single precision. Change to LPRINT for hardcopy.'
- 280 O!=A(I):PRINT O,A$
- 290 NEXT I
- 300 PRINT:PRINT"Again?":PRINT"1-same units 2-same type 3-different type"
- 310 Q$=INPUT$(1):ON VAL(Q$) GOTO 160,80,40:END
- 319 REM Lines 320-370 deal with temperature (special case).
- 320 IF N=1 THEN 350
- 330 IF N=2 THEN 360
- 340 A(1)=X-273.16:A(2)=A(1)*1.8+32:GOTO 370
- 350 A(3)=X+273.16:A(2)=X*1.8+32:GOTO 370
- 360 A(1)=(X-32)/1.8:A(3)=A(1)+273.16
- 370 RESTORE 720:GOTO 250
- 379 REM Types of measurement follow:
- 380 DATA " length"," area"," volume"," mass"
- 390 DATA " energy"," velocity"," temperature"
- 399 REM Data areas follow, beginning with constants for length.
- 400 DATA 100,1e5,2.54,30.48,91.44,1.609344e5
- 410 DATA 1.852e5,1e-8,9.46055e17
- 420 DATA centimeters, meters, kilometers, inches
- 430 DATA feet, yards, miles, naut. miles (Int'l)
- 440 DATA angstroms, light years, ""
- 450 DATA 1e4,1e10,6.4516,929.0304,8361.2736
- 460 DATA 25899881000#,40468564#
- 470 DATA square centimeters, square meters
- 480 DATA square kilometers, square inches
- 490 DATA square feet, square yards, square miles
- 500 DATA acres, ""
- 510 DATA 1000!,1E+06,16.387064#,28316.847#,764554.86#,29.5735
- 520 DATA 473.1764700000001#,946.3529400000001#,3785.4118#,4546.09,158987!
- 530 DATA cubic centimeters, liters, cubic meters
- 540 DATA cubic inches, cubic feet, cubic yards
- 550 DATA fluid ounces, fluid pints, fluid quarts
- 560 DATA gallons, Imperial gallons, barrels (oil),""
- 570 DATA 1e3,1e6,28.349523,453.59237,9.0718474e5
- 580 DATA 31.103486,373.24182,980.665
- 590 DATA grams, kilograms, metric tons
- 600 DATA ounces (avoirdupois),pounds (avoirdupois)
- 610 DATA short tons, Troy ounces, Troy pounds, dynes, ""
- 620 DATA 3.9683207e-3,9.2744135e-3,1.28408e-3,9.48451e-4
- 630 DATA 2546.14,3404.6205,9.48451e-11,2.8736047e5,9.30113e-8
- 640 DATA BTU, calories
- 650 DATA kilogram meters, foot pounds
- 660 DATA joules, horsepower hours, kilowatt hours
- 670 DATA ergs, tons of refrigeration, gram centimeters, ""
- 680 DATA 27.78,2.54,30.48,.508,44.7
- 690 DATA centimeters per second, kilometers per hour
- 700 DATA inches per second, feet per second
- 710 DATA feet per minute, miles per hour, ""
- 720 DATA degrees centigrade, degrees Farenheit
- 730 DATA degrees Kelvin, ""
- 740 ON M GOTO 760,770,780,790,800,810,820
- 750 ON M GOTO 830,840,850,860,870,880,890
- 759 REM Lines 760-820 reset to proper constants.
- 760 RESTORE 420:RETURN
- 770 RESTORE 470:RETURN
- 780 RESTORE 530:RETURN
- 790 RESTORE 590:RETURN
- 800 RESTORE 640:RETURN
- 810 RESTORE 690:RETURN
- 820 RESTORE 720:RETURN
- 829 REM Lines 830-890 reset to proper unit names.
- 830 RESTORE 400:RETURN
- 840 RESTORE 450:RETURN
- 850 RESTORE 510:RETURN
- 860 RESTORE 570:RETURN
- 870 RESTORE 620:RETURN
- 880 RESTORE 680:RETURN
- 890 RETURN
- 900 REM Additional types of measurement can be
- 901 REM added by the following steps:
- 902 REM -- Increase the number of types of
- 903 REM measurements (T, line 10).
- 904 REM -- Add the name of the type of measurement
- 905 REM to the data statement on line 390, or put
- 906 REM in a new data line at, e.g., 395. Note the
- 907 REM leading space.
- 908 REM -- Add appropriate jump vectors to lines
- 909 REM 740 and 750 (e.g., to lines 825 and 895).
- 910 REM -- Add line restoring data area for the
- 911 REM numeric constants (e.g., at line 825).
- 912 REM -- Add line restoring data area for the
- 913 REM unit name strings (e.g., at line 895).
- 914 REM -- Create appropriate data lines.
- 915 REM Note that there should be one more unit name
- 916 REM in the list than there are constants. Each
- 917 REM calculation first converts everything into
- 918 REM the first units on the list (e.g., centimeters)
- 919 REM and then multiplies by the constants to
- 920 REM arrive at the other values.
- 921 REM -- Be sure that the last data item in the
- 922 REM list of unit names is the dummy data "".
- thó_4úE909K9,u6)9' ~6 µä?3!÷*}(&ò4!93!5+31E}(&ßL2═hì¿.+äΓ2!É92ùαí¡9KΓ0æ!d║C5═h¬I5!d▀½3═U5[5 ▄&▀½3&W6 ├6É