home *** CD-ROM | disk | FTP | other *** search
- 1 REM RESISTOR COLOR CODE INTERPRETATION
- 2 REM
- 3 REM IBM PC PROGRAMS IN
- 4 REM SCIENCE AND ENGINEERING
- 5 REM
- 6 REM BY JULES H. GILDER
- 7 REM & SCOTT p. GILDER
- 8 REM
- 9 REM HAYDEN BOOK COMPANY
- 10 REM**************************
- 15 CLS:SCREEN 2
- 20 T$="RESISTOR COLOR CODE"
- 30 L=LEN(T$)
- 40 PRINT TAB(INT((80-L)/2+.5));T$
- 50 PRINT:PRINT:PRINT
- 60 DIM E$(10)
- 70 PRINT "This program interprets the resistor color code. You must enter the color"
- 80 PRINT "of each band and the program will tell you what the value of the resistor is."
- 90 RESTORE
- 100 PRINT:PRINT "Possible colors are:":PRINT
- 110 FOR X=0 TO 9
- 120 READ E$(X)
- 130 PRINT E$(X)
- 140 NEXT X
- 150 PRINT:PRINT
- 160 INPUT "Enter color of first band";A$
- 170 U$=A$:GOSUB 600:A$=U$
- 180 IF A$="gray" THEN A$="grey"
- 190 PRINT:INPUT "Enter color of second band";B$
- 200 U$=B$:GOSUB 600:B$=U$
- 210 IF B$="gray" THEN B$="grey"
- 220 PRINT:INPUT "Enter color of third band";C$
- 230 U$=C$:GOSUB 600:C$=U$
- 240 IF C$="gray" THEN C$="grey"
- 250 PRINT:PRINT:INPUT "Enter color of fourth band (gold, silver, or none)";D$
- 260 U$=D$:GOSUB 600:D$=U$
- 270 RESTORE
- 280 FOR X=0 TO 9
- 290 READ E$(X)
- 300 IF A$=E$(X) THEN Q=X
- 310 IF B$=E$(X) THEN R=X
- 320 IF C$=E$(X) THEN S=X
- 330 IF C$="white" OR C$="gold" THEN S=-1
- 340 IF C$="grey" OR C$="silver" THEN S=-2
- 350 IF D$="gold" THEN T=5
- 360 IF D$="silver" THEN T=10
- 370 IF D$="none" THEN T=20
- 380 NEXT X
- 390 GOSUB 460
- 400 PRINT:PRINT:PRINT
- 410 PRINT "Resistor value is";RE;" ";G$
- 420 PRINT
- 430 PRINT "It has a tolerance of";T;"percent"
- 440 DATA "black","brown","red","orange","yellow","green","blue","purple","grey","white"
- 450 GOTO 550
- 460 RR=10*Q+R
- 470 IF S<2 THEN G$="Ohms"
- 480 IF S=>2 AND S<5 THEN G$="Kilohms"
- 490 IF S=>2 AND S<5 THEN S=S-3
- 500 IF S=>5 THEN G$="Megohms"
- 510 IF S=>5 THEN S=S-6
- 520 RE=INT(RR+.5)*INT(10^S+.5*S)
- 530 RE=INT(10*RR*10^S+.5)/10
- 540 RETURN
- 550 PRINT:PRINT:PRINT
- 560 PRINT "Do you have another resistor (Y or N)"
- 570 AN$=INKEY$:IF AN$="" THEN 570
- 575 IF AN$="y" OR AN$="Y" THEN RUN
- 580 END
- 590 REM ROUTINE TO CONVERT UPPERCASE TO LOWERCASE
- 600 U2$=""
- 610 FOR U=1 TO LEN (U$)
- 620 U1$=MID$(U$,U,1)
- 630 U1=ASC(U1$)
- 640 IF U1<91 THEN U1=U1+32
- 650 U2$=U2$+CHR$(U1)
- 660 NEXT U
- 670 U$=U2$
- 680 RETURN
- {╔vÉn╜0░φΓφ╠nδ0@║n┼S╨∞. ╪╗╩Ö£╜á