Multiplication Tutor

This program is designed to lead students, step by step, through the intricacies of multiplying multi-digit numbers. You are first asked to specify the range of multiplicand (to 999,999) and multiplier (to 999). Then the computer asks your name, and courteously addresses you by that name throughout the program. (I wonder how many students give in to the temptation to use a rude word here, or at least a colorful nickname–ed.) You are then asked to decide how many problems you are going to set for yourself to do.

From then on, the program leads you, step by step, through the multiplication of a pair of numbers, chosen at random within the limits you have set. Every character is blinked in the sequence in which it should be handled. Even “carries” are taken into consideration.

Fig. 1 MULTIPLICATION TUTOR in action (note the prompt to CARRY 3, above the 8)
Fig. 1 MULTIPLICATION TUTOR in action (note the prompt to CARRY 3, above the 8)

If you give a wrong answer, the computer insistently blinks the steps again, and keeps on doing so until your answer is right. When you have successfully completed a problem, the computer asks you whether you would like to do another (unless you have already finished the number that you contracted to do). If you say “no”, prepare for a shock–see line 869.

Editor’s Comments

They say you shouldn’t judge a book by its cover (or my daughter tells a story that indicates that you shouldn’t book a judge by his cover). It’s hard to follow that advice in this case, though. The cassette box was neatly labeled with all that an editor needs: name, address, and telephone number of the author; title and SAVE label of the program; a list of the hardware needed. A dream!

I have just three criticisms, two of them trivial: first, there is no provision made to abort the program, and second, you’re a little way into the program before the computer asks your name. Sort of reminds me of those irritating TV commercials, where the salesman makes about a third of the pitch, and then says “Hi! I’m Fulano de Tal”, or whoever. Maybe some psychologist said that it’s good sales technique. Possibly Miss Manners would concur, but I dunno.

A little more importantly, I think it would have been helpful to display the correct answer if a student gave the wrong reply more than once.

   1 REM MULTIPLICATION TUTOR      BY            SHAWN BYRNE
5 GOTO 9000
20 PRINT "RANGE OF:"
25 PRINT "MULTIPLICAND(TO 999,999)?"
30 INPUT R1
40 PRINT AT 1,0;"MULTIPLIER (TO 999)? "
50 INPUT R2
65 RAND
66 CLS
67 PRINT "HELLO, TYPE IN YOUR NAME AND THEN PRESS ENTER."
69 INPUT Z$
71 CLS
72 PRINT Z$;", THIS IS AN";TAB 0;"EASY AND FUN WAY TO LEARN","MULTIPLICATION.",,,,
73 GOTO 75
74 CLS
75 PRINT "HOW MANY PROBLEMS DO YOU","WANT TO DO?",,"TYPE IN THE NUMBER"," AND PRESS ENTER."
77 INPUT Z
80 FOR W=U TO Z
81 CLS
82 LET R$=STR$ INT (RND*R1+U)
85 LET Q$=STR$ INT (RND*R2+U)
90 LET L=LEN R$
95 LET E=LEN Q$
100 FOR A=U TO L
110 LET B=VAL R$(L+U-A)+U
120 LET C=33-3*A
130 PRINT AT U,C;N$(B,U);TAB C;N$(B,2);TAB C;N$(B,3)
140 NEXT A
150 PRINT AT 6,21;"▒▒";TAB 21;"▒▒"
160 LET C=30
170 LET B=VAL Q$(E)+U
180 PRINT AT 5,C;N$(B,U);TAB C;N$(B,2);TAB C;N$(B,3)
190 IF E=U THEN GOTO 230
200 LET C=27
210 LET B=VAL Q$(U)+U
220 PRINT AT 5,C;N$(B,U);TAB C;N$(B,2);TAB C;N$(B,3)
230 PRINT AT 8,0;M$
235 IF L>4 THEN PRINT AT 8,33-3*L;L$( TO 3*L-U)
240 IF L<=4 THEN PRINT AT 8,21;"▒▒▒▒▒▒▒▒▒▒▒▒"
250 PRINT AT 0,0;M$
260 LET C=VAL Q$(E)+U
270 LET H=30-3*(LEN Q$-E)
272 IF Q$(LEN Q$)<>"0" THEN GOTO 280
274 LET C=VAL Q$(U)+U
276 LET H=27
278 PRINT AT 9,30;"▒▒";TAB 30;"▒▒";TAB 30;"▒▒"
280 LET C$="0"
300 FOR A=U TO L
310 LET B=VAL R$(L+U-A)+U
320 LET B$=STR$ ((C-U)*(B-U)+VAL C$)
323 LET K=9
330 LET F=33-3*A
333 LET J=F
335 IF (LEN Q$<>2 OR E<>U) AND Q$(LEN Q$)<>"0" THEN GOTO 350
337 LET J=F-3
339 IF Q$(LEN Q$)<>"0" THEN GOTO 348
345 GOTO 350
348 LET K=13
350 FOR G=U TO 2
355 PRINT AT U,F;" ";TAB F;" ";TAB F;" "
360 PRINT AT U,F;N$(B,U);TAB F;N$(B,2);TAB F;N$(B,3)
370 NEXT G
380 FOR G=U TO 2
382 PRINT AT 6,21;" ";TAB 21;" "
384 PRINT AT 6,21;"▒▒";TAB 21;"▒▒"
386 NEXT G
388 FOR G=U TO 2
390 PRINT AT 5,H;" ";TAB H;" ";TAB H;" "
392 PRINT AT 5,H;N$(C,U);TAB H;N$(C,2);TAB H;N$(C,3)
394 NEXT G
395 IF C$="0" THEN GOTO 460
400 FOR G=U TO 2
403 PRINT AT 0,F-U;"+"
406 FOR I=U TO 2
409 NEXT I
412 PRINT AT 0,F-U;" "
415 NEXT G
418 FOR G=U TO 2
421 PRINT AT 0,F;" "
424 PRINT AT 0,F;C$
427 FOR I=U TO 2
430 NEXT I
433 NEXT G
460 FOR G=U TO 60
465 PRINT AT K,J;"▒▒▒";TAB J;" ▒▒";TAB J;" ▒ "
470 LET A$=INKEY$
480 IF A$>="0" AND A$<="9" THEN GOTO 510
490 PRINT AT K,J;" ";TAB J;" ";TAB J;" "
500 NEXT G
505 GOTO 340
510 PRINT AT K,J;N$(VAL A$+U,U);TAB J;N$(VAL A$+U,2);TAB J;N$(VAL A$+U,3)
520 IF A$=B$(LEN B$) THEN GOTO 560
530 FOR G=U TO 10
540 NEXT G
550 GOTO 340
560 IF LEN B$=U THEN GOTO 805
570 IF A=L THEN GOTO 690
572 FOR G=U TO 5
574 NEXT G
580 PRINT AT 0,F-3;"?"
590 LET A$=INKEY$
600 IF A$>="0" AND A$<="9" THEN GOTO 630
610 PRINT AT 0,F-3;" "
620 GOTO 580
630 PRINT AT 0,F-3;A$
640 IF A$=B$(U) THEN GOTO 680
650 FOR G=U TO 10
660 NEXT G
670 GOTO 340
680 LET C$=A$
682 GOTO 810
690 LET J=J-3
695 PRINT AT K,J;"▒▒▒";TAB J;" ▒▒";TAB J;" ▒ "
700 LET A$=INKEY$
710 IF A$>="0" AND A$<="9" THEN GOTO 740
720 PRINT AT K,J;" ";TAB J;" ";TAB J;" "
730 GOTO 695
740 PRINT AT K,J;N$(VAL A$+U,U);TAB J;N$(VAL A$+U,2);TAB J;N$(VAL A$+U,3)
750 IF A$=B$(U) THEN GOTO 800
760 FOR G=U TO 10
770 NEXT G
780 PRINT AT K,J;" ";TAB J;" ";TAB J;" "
790 GOTO 330
805 LET C$="0"
810 NEXT A
815 IF Q$(LEN Q$)="0" THEN GOTO 830
820 IF E=2 THEN GOTO 900
825 IF LEN Q$=2 THEN GOTO 920
830 FOR G=U TO 100
840 NEXT G
841 IF Z<>W THEN GOTO 850
842 CLS
843 PRINT "DO YOU WANT TO DO","SOME MORE ";Z$;"?"
844 PRINT "PRESS Y FOR YES OR N FOR NO"
845 IF INKEY$="Y" THEN GOTO 74
846 IF INKEY$="N" THEN GOTO 66
847 GOTO 845
849 GOTO 66
850 CLS
855 PRINT "GOOD, ";Z$;TAB 0;"DO YOU WANT TO DO ANOTHER?","PRESS Y FOR YES OR N FOR NO"
860 LET A$=INKEY$
863 IF A$<>"Y" AND A$<>"N" THEN GOTO 860
866 IF A$="Y" THEN PRINT "OK,";
869 IF A$="N" THEN PRINT "TOO BAD,";
872 PRINT " HERE WE GO AGAIN"
874 FOR G=U TO 50
875 NEXT G
877 NEXT W
880 GOTO 66
900 LET E=U
905 PRINT AT 13,30;"▒▒";TAB 30;"▒▒";TAB 30;"▒▒"
910 GOTO 250
920 LET J$=STR$ (VAL R$*VAL Q$(2))
930 LET K$=STR$ (10*VAL R$*VAL Q$(U))
933 LET D=LEN J$
936 LET E=LEN K$
940 PRINT AT 16,33-3*E;L$( TO 3*E-U);AT 0,0;M$
945 LET H=30-3*E
947 LET C$="0"
950 FOR A=1 TO E
960 LET F=33-3*A
962 LET C=VAL K$(E+U-A)+U
963 IF A>D THEN GOTO 1025
965 LET B=VAL J$(D+U-A)+U
968 LET B$=STR$ (C+B-2+VAL C$)
970 FOR G=U TO 2
975 PRINT AT 9,F;" ";TAB F;" ";TAB F;" "
980 PRINT AT 9,F;N$(B,U);TAB F;N$(B,2);TAB F;N$(B,3)
990 NEXT G
1000 FOR G=U TO 2
1010 PRINT AT 14,H;" ▒";TAB H;"▒▒▒"
1015 PRINT AT 14,H;" ";TAB H;" "
1020 NEXT G
1022 GOTO 1030
1025 LET B$=STR$ (C-U+VAL C$)
1030 FOR G=U TO 2
1032 PRINT AT 13,F;" ";TAB F;" ";TAB F;" "
1034 PRINT AT 13,F;N$(C,U);TAB F;N$(C,2);TAB F;N$(C,3)
1036 NEXT G
1038 IF C$="0" THEN GOTO 1070
1040 FOR G=U TO 2
1043 PRINT AT 8+4*(A>D),F-U;"+"
1046 PRINT AT 8+4*(A>D),F-U;CHR$ (10*(A<D))
1049 NEXT G
1052 FOR G=U TO 2
1055 PRINT AT 8+4*(A>D),F;" "
1058 PRINT AT 8+4*(A>D),F;C$
1061 NEXT G
1070 FOR G=U TO 60
1080 PRINT AT 17,F;"▒▒▒";TAB F;" ▒▒";TAB F;" ▒ "
1090 LET A$=INKEY$
1100 PRINT AT 17,F;" ";TAB F;" ";TAB F;" "
1110 IF A$>="0" AND A$<="9" THEN GOTO 1200
1120 NEXT G
1130 GOTO 970+60*(A>D)
1200 PRINT AT 17,F;N$(VAL A$+U,U);TAB F;N$(VAL A$+U,2);TAB F;N$(VAL A$+U,3)
1210 IF A$<>B$(LEN B$) THEN GOTO 1130
1220 IF VAL B$<=9 THEN GOTO 1370
1230 FOR G=U TO 5
1240 NEXT G
1245 IF A=E THEN GOTO 2000
1250 PRINT AT 8+4*(A>=D),F-3;"?"
1260 LET A$=INKEY$
1270 PRINT AT 8+4*(A>=D),F-3;" "
1280 IF A$<"0" OR A$>"9" THEN GOTO 1250
1290 PRINT AT 8+4*(A>=D),F-3;A$
1300 IF A$=B$(U) THEN GOTO 1340
1310 FOR G=U TO 10
1320 NEXT G
1330 GOTO 970
1340 LET C$=A$
1350 GOTO 1400
1370 LET C$="0"
1400 NEXT A
1410 GOTO 830
2000 FOR G=U TO 60
2010 PRINT AT 17,F-3;"▒▒▒";TAB F-3;" ▒▒";TAB F-3;" ▒ "
2015 LET A$=INKEY$
2020 PRINT AT 17,F-3;" ";TAB F-3;" ";TAB F-3;" "
2030 IF A$>="0" AND A$<="9" THEN GOTO 2060
2040 NEXT G
2050 GOTO 1130
2060 PRINT AT 17,F-3;N$(VAL A$+U,U);TAB F-3;N$(VAL A$+U,2);TAB F-3;N$(VAL A$+U,3)
2070 IF A$<>B$(U) THEN GOTO 1130
2080 GOTO 830
9000 LET U=1
9002 FAST
9005 DIM N$(10,3,2)
9010 LET A$="[60 graphics characters: the digit shapes 0-9; see the keying instructions below]"
9015 LET L$="[a row of underline graphics characters]"
9017 LET M$=" "
9020 FOR A=U TO 10
9030 FOR B=U TO 3
9040 LET N$(A,B)=A$
9050 LET A$=A$(3 TO )
9060 NEXT B
9070 NEXT A
9075 SLOW
9080 GOTO 20
9998 SAVE "M▒"
9999 RUN

Fig.2 LISTing for MULTIPLICATION TUTOR

Rather than have you guessing as to what Shawn wanted in line 9010 of his listing, I’ve decided to include the “English” version of line 9010 here.

With the GRAPHICS mode selected (press and hold the SHIFT key then press the ‘9’ key), press and hold the SHIFT key and enter the following:

T Y 5 8 Y T 2 5

Turn the GRAPHICS mode off (press and hold the SHIFT key and then press the ‘9’ key). Press the SPACE key.

Turn the GRAPHICS mode on again, press and hold the SHIFT key and enter the following:

5 3 W T Y 3 1 W 6 7 R 2 Y Y T 4 5 W W

Turn the GRAPHICS mode off and press the SPACE key.

Turn the GRAPHICS mode on again, press and hold the SHIFT key and enter the following:

5 E 7 7 Y Y T T 1 E Y Y T 7 R

Turn the GRAPHICS mode off and press the SPACE key.

Turn the GRAPHICS mode on again, press and hold the SHIFT key and enter the following:

T

Turn the GRAPHICS mode off and press the SPACE key.

Turn the GRAPHICS mode on again, press and hold the SHIFT key and enter the following:

5 T Y T Y Y T T Y Y Q 3 T

Your line 9010 should now look like Shawn’s.-jdm

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.