Geoffrey P. Smith
It is becoming increasingly important for all students to have some level of computer literacy. It is reasonable to predict that within the life-time of the children now in New Haven Public Schools, most homes will have a microcomputer. Even for those students who may not use computers, the influence of computers on their lives will be enormous. It is incumbent on us now to begin making our students familiar with the powers and limitations of computers.
This unit contains three computer programs which can be used by any teacher interested in introducing the computer to a classroom. The programs are math-related, but they could be used in any type of classroom, because the objectives of this unit are to expose students to the process of computer use and to make students familiar with the hardware. The purpose does not include teaching programming or technical information.
In each case, the teacher loads the program from a cassette tape ahead of time, and the students only need to type appropriate information in response to directions given on the video screen. The machine used is the TRS-80 Model I, Level II, although the programs will also work on a TRS-80 Model III. The cassette is available from the Yale Institute office. A sample run of each program is listed here, plus a listing of the first program, for reasons given in Part I, below. Listings of the other two programs can be made from the tape, or can be obtained from the author.
Part I
The first program given here is intended to introduce the student to the operation of the computer as an aid in arithmetic calculation. The student types words or numbers on the keyboard; the computer responds with results, comments, or directions. The kinds of problems allowed are those which any simple calculator could handle. The student has the choice of doing addition, subtraction, multiplication, or division, and can type in either whole numbers or decimals.
The most appropriate audience is students in grades 5-8, although the program could be used with either younger or older students. The program is intended to be student-proof,
i.e.
, all kinds of possible student errors are anticipated and the computer will respond with helpful comments or suggestions.
In addition to the general objectives described in the introduction, this program was written with the thought that some students might want to see the program itself. Almost every allowable Radio Shack BASIC Level II command has been included in this program, and it is liberally sprinkled with “remarks” to make each step in the logic clear. Thus an interested student could look at particular parts of the program (or the whole thing, but that’s a lot), to see how one person has used different commands to solve a particular kind of problem. For this reason, a listing of this program is included, after the sample run which follows. Entries made by the student or teacher are shown in lowercase type and underlined.
run
____
(clear screen)
HELLO. MY NAME IS SAM.
I CAN HELP YOU DO ALL KINDS OF
ARITHMETIC PROBLEMS.
IF YOU HAVE USED ME BEFORE,
YOU MAY WANT TO SKIP THE
DETAILED INSTRUCTIONS. HOWEVER,
HERE IS ONE RULE I WILL SAY NOW:
____
ALWAYS HIT THE ‘ENTER’ KEY
____
(THAT’S THE WHITE KEY)
____
WHEN YOU HAVE FINISHED
____
TYPING AN ANSWER.
PRESS ‘ENTER’ NOW TO CONTINUE?
____
(clear screen)
FIRST, LET’S GET ACQUAINTED.
I’VE TOLD YOU MY NAME IS SAM.
WOULD YOU PLEASE
TYPE IN YOUR NAME?
geoff
IT IS A PLEASURE TO MEET YOU,
GEOFF.
I WILL DO MANY ARITHMETIC
PROBLEMS FOR YOU AS YOU
LEARN HOW TO USE ME.
PRESS ‘ENTER’ TO CONTINUE?
____
(clear screen)
NOW, DOWN TO BUSINESS, GEOFF
DO YOU WANT THE DETAILED
INSTRUCTIONS? yes
____
(clear screen)
THERE ARE JUST THREE RULES YOU
NEED TO REMEMBER FOR NOW.
1. ALWAYS HIT THE ‘ENTER’ KEY
____
WHEN YOU HAVE FINISHED
____
TYPING THE NUMBERS OR WORDS
____
YOU WANT TO TELL ME.
____
(clear screen)
2. HIT THE ‘BREAK’ KEY IF YOU
____
WANT TO STOP FOR THE DAY
____
OR IF I START TO ACT CRAZY.
____
(ME? CRAZY? HO! HO! HO!)
____
(clear screen)
3. USE THE ‘BACK ARROW’ KEY
IF YOU WANT TO ERASE
SOMETHING YOU HAVE TYPED.
(THAT’S THE KEY ON THE RIGHT
SIDE OF THE BOARD WITH THE
ARROW POINTING TO THE LEFT)
DO YOU THINK YOU CAN
REMEMBER THESE RULES, NOW?
yes
____
(clear screen)
WOULD YOU LIKE TO DO:
____
1. ADDITION
____
2. SUBTRACTION
____
3. MULTIPLICATION
____
4. DIVISION
WHICH KIND OF PROBLEM (NUMBER 1, 2, 3, OR 4) DO YOU WANT TO TRY?
1
____
(clear screen)
ADDITION IT IS, GEOFF.
TYPE IN THE TWO NUMBERS YOU
WANT ADDED, SEPARATED BY A
COMMA.
I WILL SHOW YOU WHAT I MEAN:
____
(clear screen)
********************************
* EXPLANATION FOR
|
*
|
* TYPING IN NUMBERS
|
*
|
********************************
IF YOU WANT TO HAVE ME
(FOR EXAMPLE)
USE THE NUMBERS SIX AND THREE
THEN TYPE: 6,3
PRESS ‘ENTER’ TO CONTINUE?
DO NOT USE COMMAS IN WRITING LARGE NUMBERS.
____
(clear screen)
IF YOU WANT TO HAVE ME
(FOR ANOTHER EXAMPLE)
USE THE NUMBERS TWENTY THOUSAND
AND THIRTY THOUSAND,
THEN TYPE: 20000,30000
|
(NOTE JUST ONE COMMA
|
BETWEEN THE NUMBERS)
|
IF YOU TYPE: 20,000, 30,000
THE EXTRA COMMAS WILL JUST
CONFUSE ME. OKAY?
PRESS ‘ENTER’ TO CONTINUE?
WHAT ARE THE NUMBERS?
54,32
____
(clear screen)
54 + 32 = 86
WANT TO TRY ANOTHER ADDITION
PROBLEM?
no
WANT TO TRY ANOTHER KIND OF
PROBLEM? yes
____
(clear screen)
WOULD YOU LIKE TO DO:
____
1. ADDITION
____
2. SUBTRACTION
____
3. MULTIPLICATION
____
4. DIVISION
WHICH KIND OF PROBLEM
(NUMBER 1, 2, 3, OR 4) DO
YOU WANT TO TRY?
4
____
(clear screen)
YOU REALLY WANT ME TO WORK, DON’T YOU, GEOFF? DIVISION IS HARD, BUT I’LL SHOW YOU HOW FAST IT CAN BE DONE!
TYPE THE TWO NUMBERS YOU WANT DIVIDED, SEPARATED BY A COMMA.
WHAT ARE THE NUMBERS?
24,6
____
(clear screen)
24 / 6 = 4
THAT WASN’T SO HARD, GEOFF!
WANT TO SEE ME DO ANY MORE
DIVISION PROBLEMS?
yes
WHAT ARE THE NUMBERS? 24,7
____
(clear screen)
DON’T WORRY, I’LL DO THAT PROBLEM, GEOFF. I’M NOT STALLING - BUT FIRST YOU HAVE TO MAKE A DECISION ABOUT THE REMAINDER.
____
(YES, YOU GAVE ME
____
A PROBLEM THAT HAS
____
A REMAINDER.)
I CAN DO REMAINDERS THREE WAYS.
PRESS ‘ENTER’ FOR EXPLANATION
OF THREE WAYS?
____
(clear screen)
DO YOU WANT THE REMAINDER AS
1. A WHOLE NUMBER
LIKE: 6/4 = 1 R 2
2. A DECIMAL FRACTION
LIKE: 6/4 = 1.5
3. A COMMON FRACTION
____
IN SIMPLEST FORM
LIKE: 6/4 = 1 1/2
TYPE THE NUMBER FOR THE WAY YOU
WANT THE REMAINDER EXPRESSED.
WHICH?
1
____
(clear screen)
____
24 / 7 = 3 R 3
SEE, I TOLD YOU I COULD DO IT.
WANT TO SEE ME DO ANY MORE
DIVISION PROBLEMS?
no
WANT TO TRY ANOTHER KIND OF
PROBLEM?
no
WELL, I’M READY NOW TO MEET SOMEONE ELSE.
SO, GOODBYE, GEOFF,
WE CAN WORK AGAIN ON
ANOTHER DAY. LET A NEW PERSON HAVE A TURN FOR AWHILE.
NEXT .. . .
FIRST, LET’S GET ACQUAINTED.
I’VE TOLD YOU MY NAME IS SAM.
WOULD YOU PLEASE
TYPE IN YOUR NAME?
BREAK IN 90
READY
list
|
(listing begins on
|
next page)
|
-
5 REM - INTRODUCTORY PROGRAM -
-
10 REM - SAM, THE COMPUTER, CAN HELP YOU DO ARITHMETIC.
-
20 REM - STRING VARIABLES USED IN THIS PROGRAM:
-
25 DEFSTR N,R
-
30 ON ERROR GOTO 8000
-
35 ST=O: T=1
-
36 REM - ‘ST’ WILL COUNT THE STUDENTS USING THE PROGRAM
-
37 REM - ‘T’ IS USED TO LOCATE WHERE YOU ARE IN THE PROGRAM
-
38 REM (USEFUL FOR ‘RETURN’ AFTER ERROR SUBROUTINE)
-
39 CLS: PRINT CHR$(23)
-
40 PRINT “HELLO. MY NAME IS SAM.”: PRINT
-
45 PRINT “I CAN HELP YOU DO ALL KINDS OF”
-
46 PRINT “ARITHMETIC PROBLEMS.”
-
47 FOR I=1 TO 2000: NEXT I: PRINT
-
50 PRINT “IF YOU HAVE USED ME BEFORE,”
-
51 PRINT “YOU MAY WANT TO SKIP THE”
-
55 PRINT “DETAILED INSTRUCTIONS. HOWEVER,”
-
60 PRINT “HERE IS ONE RULE I WILL SAY NOW:”
-
65 PRINT: PRINT TAB(5) “ALWAYS HIT THE ‘ENTER’ KEY”
-
70 PRINT TAB(5) “(THAT’S THE WHITE KEY3”
-
75 PRINT TAB(5) “WHEN YOU HAVE FINISHED”
-
76 PRINT TAB(5) “TYPING AN ANSWER.”
-
78 PRINT: INPUT “PRESS ‘ENTER’ NOW TO CONTINUE”;N1
-
80 REM - MUTUAL INTRODUCTION FOLLOWS:
-
82 CLS: PRINT CHR$(23): T=2
-
84 PRINT “FIRST, LET’S GET ACQUAINTED.”
-
86 PRINT “I’VE TOLD YOU MY NAME IS SAM.”
-
88 PRINT “WOULD YOU PLEASE”
-
90 INPUT “TYPE IN YOUR NAME”;NM
-
92 IF NM=”YES” THEN 90
-
94 IF NM=”NO” THEN 86
-
96 PRINT “IT IS A PLEASURE TO MEET YOU,”
-
98 PRINT NM;”.”: IF NM=”SAM” PRINT “ WHAT A GREAT NAME!”
-
100 ST=ST+1: REM - COUNTING THE STUDENTS USING SAM
-
102 PRINT: PRINT
-
104 PRINT “I WILL DO MANY ARITHMETIC”
-
106 PRINT “PROBLEMS FOR YOU AS YOU”
-
108 PRINT “LEARN HOW TO USE ME.”
-
110 PRINT: PRINT: INPUT “PRESS ‘ENTER’ TO CONTINUE”;N2
-
112 CLS: PRINT CHR$(23): T=3
-
114 PRINT “NOW, DOWN TO BUSINESS, “;NM
-
116 PRINT “DO YOU WANT THE DETAILED”
-
118 INPUT “INSTRUCTIONS”;R1
-
120 IF R1=”YES” THEN 200
-
122 REM - DETAILED INSTRUCTIONS FOLLOW LINE 200
-
124 IF R1=”NO” THEN 395
-
126 PRINT “TYPE YES OR NO, PLEASE.”
-
128 GOTO 116
-
200 REM - DETAILED INSTRUCTIONS:
-
205 CLS: PRINT CHR$(23): LV=1
-
206 REM - ‘LV’ IS THE STUDENT LEVEL. ‘1’ MEANS BEGINNER
-
207 REM (BECAUSE STUDENT REQUESTED INSTRUCTIONS)
-
210 PRINT “THERE ARE JUST THREE RULES YOU”
-
211 PRINT “NEED TO REMEMBER FOR NOW.”
-
215 PRINT 320, “ “
-
220 PRINT “1. ALWAYS HIT THE ‘ENTER’ KEY”
-
221 PRINT “ WHEN YOU HAVE FINISHED”
-
225 PRINT “ TYPING THE NUMBERS OR WORDS”
-
230 PRINT “ YOU WANT TO TELL ME.”
-
231 FOR I=1 TO 3000: NEXT I
-
232 IF LV=2 GOTO 245
-
240 PRINT 320, “ “
-
245 PRINT “2. HIT THE ‘BREAK’ KEY IF YOU”
-
246 PRINT “ WANT TO STOP FOR THE DAY”
-
247 PRINT “ OR IF I START TO ACT CRAZY.”
-
248 IF LV=2 GOTO 250
-
249 PRINT “ (ME? CRAZY? HO! HO! HO!)”
-
250 FOR I=1 TO 3000: NEXT I
-
251 IF LV=2 GOTO 255
-
253 PRINT 320, “ “
-
255 PRINT “3. USE THE ‘BACK ARROW’ KEY”
-
256 PRINT “ IF YOU WANT TO ERASE”
-
257 PRINT “ SOMETHING YOU HAVE TYPED.”: IF LV=2 THEN 261
-
258 PRINT “ (THAT’S THE KEY ON THE RIGHT”
-
259 PRINT “ SIDE OF THE BOARD WITH THE”
-
260 PRINT “ ARROW POINTING TO THE LEFT)”
-
261 FOR I=1 TO 3000: NEXT I
-
262 PRINT: PRINT: T=4
-
263 PRINT “DO YOU THINK YOU CAN”
-
264 INPUT “REMEMBER THESE RULES, NOW”;R2
-
265 IF R2=”YES” THEN 397
-
270 IF R2=”NO” THEN 280
-
275 PRINT “TYPE YES OR NO, PLEASE.”: GOTO 263
-
280 LV=2: CLS: PRINT CHR$(23): PRINT “HERE THEY ARE AGAIN:”
-
282 GOTO 220
-
285 REM - ‘LEVEL 2, BECAUSE THE STUDENT IS REVIEWING THE RULES
-
395 LV=3
-
396 REM - ‘LEVEL 3’ BECAUSE THE STUDENT SKIPPED INSTRUCTIONS
-
397 PR=0
-
398 REM - ‘PR’ WILL COUNT THE NUMBER OF PROBLEMS DONE
-
399 REM (MAXIMUM OF SIX PER STUDENT)
-
400 REM - CHOICE OF OPERATIONS FOLLOWS:
-
410 CLS: PRINT CHR$(23): PRINT “WOULD YOU LIKE TO DO:”
-
420 PRINT TAB(5) “1. ADDITION”
-
430 PRINT TAB(5) “2. SUBTRACTION”
-
440 PRINT TAB(5) “3. MULTIPLICATION”
-
450 PRINT TAB(5) “4. DIVISION”
-
460 PRINT: PRINT: T=5
-
470 PRINT “WHICH KIND OF PROBLEM”
-
471 PRINT “(NUMBER 1, 2, 3, OR 4) DO”
-
475 INPUT “YOU WANT TO TRY”;C1
-
480 ON C1 GOTO 500, 600, 700, 800
-
490 PRINT “PERHAPS YOU MISUNDERSTOOD.”
-
495 PRINT “TYPE ONLY THE NUMBER 1, 2,”
-
496 PRINT “3, OR 4.”: GOTO 470
-
500 REM - ADDITION PROBLEMS
-
510 CLS: PRINT CHR$(23): PRINT “ADDITION IT IS, “;NM;”.”
-
520 PRINT “TYPE IN THE TWO NUMBERS YOU”
-
521 PRINT “WANT ADDED, SEPARATED BY A”
-
522 PRINT “COMMA.”
-
530 IF LV=1 OR LV=2 GOSUB 9000
-
535 PRINT: INPUT “WHAT ARE THE NUMBERS”;A1,A2
-
540 CLS: PRINT CHR$(23)
-
545 PRINT 260, A1;” + “;A2;” = “;A1+A2
-
550 PR=PR+1
-
555 IF PR>5 GOTO 1000
-
560 PRINT: PRINT: PRINT: T=6
-
565 PRINT “WANT TO TRY ANOTHER ADDITION”
-
566 INPUT “PROBLEM”;R3
-
570 V=0: REM - ‘V’ DEFINED BY AND FOR SUBROUTINE 9100
-
575 IF R3=”YES” THEN 535
-
580 IF R3=”NO” GOSUB 9100
-
585 ON V+1 GOTO 590, 400, 1000
-
590 INPUT “TYPE YES OR NO, PLEASE”;R3
-
595 GOTO 575
-
600 REM - SUBTRACTION PROBLEMS
-
605 CLS: PRINT CHR$(23)
-
606 PRINT “OKAY, COMING RIGHT UP, “;NM;”.”
-
607 PRINT TAB(5) “- - - SUBTRACTION - - -”
-
610 PRINT: PRINT “TYPE IN THE TWO NUMBERS YOU”
-
611 PRINT “WANT SUBTRACTED, SEPARATED”
-
615 PRINT “BY A COMMA.”
-
620 IF LV=1 GOSUB 9000
-
625 PRINT: INPUT “WHAT ARE THE NUMBERS”;M,S
-
630 IF M>=S THEN 642
-
631 PRINT “DID YOU MEAN TO HAVE THE LARGER”
-
632 PRINT “NUMBER SUBTRACTED FROM THE”
-
633 INPUT “SMALLER NUMBER”;R4
-
635 IF R4=”YES” THEN 642
-
637 PRINT “I’LL SWITCH THEM AROUND THE”
-
638 PRINT “OTHER WAY, “;NM;”.”
-
639 H=M: M=S: S=H
-
640 FOR I=1 TO 1000: NEXT I
-
642 CLS: PRINT CHR$(23)
-
645 PRINT 260, M;” - “;S;” = “;M-S
-
650 PR=PR+1
-
655 IF PR>5 THEN 1000
-
660 PRINT: PRINT: PRINT: PRINT
-
665 PRINT “WANT TO TRY ANOTHER”
-
667 INPUT “SUBTRACTION PROBLEM”;R5
-
670 V=0: T=7
-
675 IF R5=”YES” THEN 625
-
680 IF R5=”NO” GOSUB 9100
-
685 ON V+1 GOTO 690, 400, 1000
-
690 INPUT “TYPE YES OR NO, PLEASE”;R5
-
695 GOTO 675
-
700 REM - MULTIPLICATION PROBLEMS
-
705 CLS: PRINT CHR$(23)
-
706 PRINT “OKAY, “;NM;”,”
-
707 PRINT “WE’LL DO MULTIPLICATION.”
-
710 PRINT “TYPE IN THE TWO NUMBERS YOU”
-
711 PRINT “WANT MULTIPLIED, SEPARATED BY”
-
715 PRINT “A COMMA.”
-
720 IF LV=2 GOSUB 9000
-
725 PRINT: INPUT “WHAT ARE THE NUMBERS”;F1 ,F2
-
735 CLS: PRINT CHR$(23)
-
745 PRINT 260, F1;” X “;F2;” = “;F1*F2
-
750 PR=PR+1
-
755 IF PR>5 GOTO 1000
-
760 PRINT: PRINT: PRINT: PRINT
-
765 PRINT “WANT TO HAVE ME DO MORE”
-
766 INPUT “MULTIPLICATION”;R6
-
770 V=0: T=8
-
775 IF R6=”YES” THEN 725
-
780 IF R6=”NO” GOSUB 9100
-
785 ON V+1 GOTO 790, 400, 1000
-
790 INPUT “TYPE YES OR NO, PLEASE”;R6
-
795 GOTO 775
-
800 REM - DIVISION PROBLEMS
-
805 CLS: PRINT CHR$(23)
-
806 PRINT “YOU REALLY WANT ME TO WORK,”
-
807 PRINT “DON’T YOU, “;NM;”? DIVISION”
-
810 PRINT “IS HARD, BUT I’LL SHOW YOU”
-
812 PRINT “HOW FAST IT CAN BE DONE!”
-
815 PRINT: PRINT “TYPE THE TWO NUMBERS YOU”
-
816 PRINT “WANT DIVIDED, SEPARATED BY”
-
820 PRINT “A COMMA.”: T=9: DP=1: REM - ‘DP’ COUNTS IN 9200 SUBR
-
825 IF LV=3 GOTO 850
-
830 PRINT “BE SURE TO PUT THE NUMBER YOU”
-
831 PRINT “WANT DIVIDED FIRST AND THE”
-
832 PRINT “NUMBER YOU WANT TO DIVIDE BY”
-
833 PRINT “SECOND.”
-
834 FOR I=1 TO 4000: NEXT I
-
835 IF LV=1 GOTO 848
-
836 CLS: PRINT CHR$(23)
-
837 PRINT “FOR EXAMPLE, IF YOU TYPE: 6,3”
-
838 PRINT TAB(5) “I WILL SAY: 6/3 = 2”
-
840 PRINT “HOWEVER, IF YOU TYPE: 3,6”
-
842 PRINT TAB(5) “I WILL SAY: 3/6 = 1/2”
-
844 PRINT “SO YOU SEE, “;NM;,”
-
845 PRINT “IT MAKES A DIFFERENCE”
-
846 PRINT “WHICH ORDER YOU USE.”
-
847 FOR I=1 TO 3000: NEXT I
-
848 LV=3: RKM - ‘LEVEL 3’ TO AVOID REPEATING INSTRUCTIONS
-
849 PRINT: PRINT “NOW, BE CAREFUL -”
-
850 PRINT: INPUT “WHAT ARE THE NUMBERS”;DIV,DVI
-
852 IF DVI>0 THEN 856
-
854 PRINT “YOU CAN NOT DIVIDE BY ZERO.”
-
855 PRINT “TRY AGAIN.”: GOTO 849
-
856 Z=DIV/DVI
-
858 IF Z=INT(Z) THEN 900
-
859 IF DIV>INT(DIV) OR DVI>INT(DVI) THEN 900
-
860 GOSUB 9200
-
865 ON C3 GOTO 870, 900, 930
-
870 Q=INT(Z): LF=DIV - Q*DVI
-
875 CLS: PRINT CHR$(23)
-
880 PRINT 260, DIV;”/”;DVI;” = “;Q;” R “;LF
-
885 PRINT: PRINT: PRINT
-
890 PRINT “SEE, I TOLD YOU I COULD DO IT.”
-
895 GOTO 968
-
900 CLS: PRINT CHR$(23)
-
905 PRINT 260, DIV;”/”;DVI;” = “;Z
-
910 PRINT: PRINT: PRINT
-
915 PRINT “THAT WASN’T SO HARD, “;NM:”!”
-
920 GOTO 968
-
930 CLS: PRINT CHR$(23)
-
932 PRINT “OKAY, HOLD ON. I’M WORKING ON”
-
934 PRINT “FINDING THE SIMPLEST FRACTION.”
-
936 V2=ABS(DIV): D2=ABS(DVI)
-
938 W=SGN(DIV*DVI)
-
940 REM - ‘W’ INDICATES SIGN OF ANSWER
-
942 Q=INT(V2/D2): LF=V2-Q*D2
-
944 L2=LF: C2=0
-
950 FOR F=L2 TO 2 STEP -l
-
952 IF C2=1 THEN 960
-
954 IF L2/F>INT(L2/F) THEN 960
-
956 IF D2/F>INT(D2/F) THEN 960
-
958 L2=L2/F: D2=D2/F: C2=l
-
960 NEXT F
-
961 IF LF26 THEN 966
-
962 PRINT “WHEW! THAT WAS REALLY HARD!”
-
963 PRINT “BUT I GOT IT AT LAST,”