20 REM
30 REM **variable definitions
35 REM N$ = student name
40 REM a = first factor
50 REM b = second factor
60 REM c =correct response
70 REM s = student response
80 REM cr = number of correct responses
90 REM ir = number of incorrect response
100 REM sc = score
110 REM
120 CR = 0:IR = 0
125 CLS: REM clear screen
130 PRINT "MULTIPLICATION DRILL"
135 PRINT
140 INPUT "what is your name"; N$
145 PRINT
150 PRINT "Pay attention. ";N$". This is a test of your"
165 PRINT "asked to multiply twenty pairs of numbers. Consider"
170 PRINT "your answers carefully. Your whole future could hang"
175 PRINT "in the balance."
178 PRINT "
180 PRINT "A score of 85 is considered passing. Good luck!"
190 PRINT
200 REM *** loop through sequence of questions
210 FOR J = 1 to 20
212 RANDOMIZE TIMER
215 PRINT
220 LET A = INT (RND (10) * 10)
230 LET B = INT (RND (10) * 10)
240 REM * compute correct answer
250 C = A * B
260 REM * obtain student response
270 PRINT "Sorry, the correct answer was "C". Tisk, tisk"
310 IR = IR + 1
320 GO TO 400
350 PRINT "Congratulations. This is a correct answer!"
360 CR = CR + 1
400 NEXT J
450 REM *** compute final score
460 SC = (C/(CR + IR))* 100
470 IF SC <85 THEN 500
475 PRINT:PRINT
480 PRINT "Good work, "N$". Your score was "SC". 85 was considered passing.
490 STOP
500 REM * failing score routine
505 PRINT:PRINT
510 PRINT "Too bad, "N$". You failed with a score of "SC". 85 was passing."
520 PRINT "Too bad, "N$". You failed with a score of "SC". 85 was passing."
530 STOP "Keep practicing. You CAN improve!"
Figure 2-12. Example of a computer program written in BASIC.
MD0058
2-15