10 REM Learning Program by WKP OHMSLAW2D.BAS 20 REM Declare and Initialize Constants and Variables 30 REM Question Counter 40 LET Q = 1 50 REM Number of tries at answering the question counter 60 LET TRY = 0 70 REM VOLTS, AMPS & OHMS are the three variables used for calculations and answers 80 REM Create the VOLTS Array 90 DIM QV(6) 100 REM Fill up the array with test data 110 LET QV(1) = 7.5 120 LET QV(2) = 12 130 LET QV(3) = 6 140 LET QV(4) = 3.3 150 LET QV(5) = 9 160 LET QV(6) = 5 170 REM Create the AMPS Array 180 DIM QA(6) 190 REM Fill up the array with test data 200 LET QA(1) = .002 210 LET QA(2) = .100 220 LET QA(3) = .025 230 LET QA(4) = .040 240 LET QA(5) = .250 250 LET QA(6) = .050 300 REM Create the OHMS Array 310 DIM QO(6) 320 REM Fill up the array with test data 330 LET QO(1) = 470 340 LET QO(2) = 1000 350 LET QO(3) = 300 360 LET QO(4) = 1200 370 LET QO(5) = 680 380 LET QO(6) = 100 390 GOSUB 2000 400 PRINT " Ohm's Law Calculator ... OHMSLAW.BAS" 410 PRINT " by Walt Perko" 420 GOSUB 3000 430 PRINT " Did you learn Ohms Law from OHMSLAW0.BAS or OHMSLAW1.BAS?" 440 PRINT "" 450 PRINT " Time for a test!" 460 GOSUB 3000 470 GOSUB 1000 480 GOSUB 2000 490 PRINT " Calculate Volts" 500 GOSUB 3000 510 PRINT " E=IR or Volts = Amps * Ohms 520 GOSUB 3000 530 GOSUB 5000 540 GOSUB 2000 550 PRINT " Calculate Ohms" 560 GOSUB 3000 570 PRINT " R=V/I or Ohms = Volts / Amps 580 GOSUB 3000 590 GOSUB 6000 600 GOSUB 2000 610 PRINT " Calculate Amps" 620 GOSUB 3000 630 GOSUB 7000 640 GOSUB 2000 650 PRINT " Another Question ?" 660 INPUT "Try another =";Y$ 670 IF Y$ <> "Y" THEN GOTO 11000 680 LET Q = Q + 1 690 IF Q > 6 THEN LET Q = 1 ELSE GOTO 480 1000 FOR PAUSE = 0 TO 2000:NEXT PAUSE 1001 RETURN 2000 REM CLEAR THE SCREEN FOR NEXT DISPLAY 2010 FOR CLS = 0 TO 80 2020 PRINT "" 2030 NEXT CLS 2040 RETURN 3000 REM Move PRINT up a couple of lines 3010 FOR CLS = 0 TO 1 3020 PRINT "" 3030 NEXT CLS 3040 RETURN 5000 REM VOLTS question 5020 AMPS = QA(Q) 5030 OHMS = QO(Q) 5050 PRINT "IF E=IR, and Amps =";AMPS;" and Ohms =";OHMS;:PRINT "how many Volts are there":PRINT "" 5060 INPUT " What is your answer";GUESSV 5070 IF GUESSV = AMPS*OHMS THEN GOTO 8000 ELSE GOSUB 9000 5080 LET TRY = TRY + 1 5090 IF TRY = 1 THEN GOTO 5050 ELSE GOTO 10000 6000 REM Ohms question 6010 LET TRY = 0 6020 AMPS = QA(Q) 6030 VOLTS = QV(Q) 6040 PRINT "IF E/I=R, and Volts =";VOLTS;" and Amps =";AMPS;:PRINT "How many Ohms do we have":PRINT "" 6050 INPUT " What is your answer";GUESSO 6060 REM IF GUESS0 = VOLTS/AMPS THEN GOTO 8000 ELSE GOSUB 8000 6060 IF GUESSO < ((VOLTS/AMPS)+.5) OR GUESSO > ((VOLTS/AMPS)-.5)THEN GOTO 8000 ELSE GOSUB 9000 6070 PRINT "O=V/A =";VOLTS/AMPS 6080 LET TRY = TRY + 1 6090 IF TRY = 1 THEN GOTO 6050 ELSE GOTO 10000 7000 REM Amps question 7010 LET TRY = 0 7020 VOLTS = QV(Q) 7030 OHMS = QO(Q) 7050 PRINT "IF I=V/R, and Volts =";VOLTS; " and Ohms =";OHMS;:PRINT "then how many Amps do we have"; 7060 INPUT " What is your answer";GUESSA 7070 REM IF GUESSA = VOLTS/OHMS THEN GOTO 8000 ELSE GOSUB 9000 7070 IF GUESSA < ((VOLTS/OHMS)+.5) OR GUESSA > ((VOLTS/OHMS)-.5) THEN GOTO 8000 ELSE GOSUB 9000 7080 LET TRY = TRY + 1 7090 IF TRY = 1 THEN GOTO 7050 ELSE GOTO 10000 8000 REM The user got the question right! 8010 GOSUB 3000 8020 PRINT " C O R R E C T !" 8030 GOSUB 1000 8040 RETURN 9000 REM The user got the question wrong! 9010 GOSUB 3000 9030 PRINT " W R O N G !" 9040 PRINT "" 9060 PRINT " TRY AGAIN!" 9070 GOSUB 1000 9080 RETURN 9999 END 10000 REM Failed twice! 10010 GOSUB 3000 10020 PRINT " Two Incorrect Answers," 10030 PRINT "" 10040 PRINT " That's okay, maybe you just need to practice your math skills." 10050 PRINT "" 10060 GOSUB 1000 10070 PRINT "" 10080 GOSUB 1000 10090 PRINT "" 10099 RETURN 11000 REM Closing out the program 11010 GOSUB 2000 11020 PRINT "" 11030 PRINT "" 11040 PRINT "" 11050 END