The Best of Creative Computing Volume 1 (published 1976)

Page 190 << PREVIOUS >> NEXT Jump to page:
Go to contents Go to thumbnails

Beginning with BASIC (programming activities for junior-high school students)

graphic of page

A new learning activity from Creative Computing....

Beginning With BASIC

by William R. Morrison
Curtis Jr. High School
Sudbury, Massachusetts

The act of sitting down at a computer terminal creates a closed world. Even
first-time users become absorbed, lose track of time, and seek only to further
whatever dialogue they are involved in. Can you remember the pleasures of
getting the machine to do what you wanted it to? Or the frustrations of many
error messages? These two activities are designed for junior-high school
students to use as part of an introductory unit on computers. They are intended
to help make that first experience informative; to let students learn step by
step how the computer responds to various commands; and finally to let students
form their own images of the computer as a partner in a dialogue.

A. EXERCISES IN IMMEDIATE MODE
This first guide takes the student from immediate mode to a simple program. It
presents a minimum of rules, emphasizing instead a series of actions, and lets
the student draw whatever conclusions he can. The impact of these first
impressions will later be the foundation for a more formalized presentation, the
objects of which should be familiar. Explanations tend to turn students off
unless they have already had an experience that makes them eager to know why.

Some Things to Try With a Computer that Speaks BASIC:

1. Try some PRINT statements:

PRINT MY COMPUTER SPEAKS BASIC

What happened? Did you forget something? Correct the command and try again. Will
the computer accept something like: 2+5=4? Can you make it print such arithmetic
nonsense? Now print your name and the date.

2. Try this: PRINT "SOME ARITHMETIC"; 22*33;35/7O;5-9,7+9
What happens when you use the ; or the ,? How does the computer handle
fractions? Try a few, such as 1/3+5/8, and see.

3. Here is a short program. Type it in and try it out.

10 INPUT A
20 INPUT B
30 PRINT A "TIMES" B "IS" A*B
40 GOTO 10

If something went wrong, remember that everything you type in has meaning to the
computer, every quote mark, comma, etc.

4. Let's make some changes and see how this program can be improved. You don't
have to type the whole thing over again, of course; change the lines by typing
the line number and its line. First, though, stop the computer from running the
old program by typing CTRL/C.

Change line 20: Type: 20 LET B=1
Change line 40: Type: 40 LET B=B+1
Add a line 50: Type: 50 GOTO 30

What happened to old line 20? Find out by asking the computer to LIST the
program. Now, try a RUN of the program. Stop the program with CTRL/C - does
CTRL/C stop the computer while it is LISTing a program?

Give the program a title with:

5 PRINT "TlMES TABLE"

Do you see why line numbers go up by 10's? Now make the program stop
automatically when it gets to A times 10:

45 IF B=10 THEN 60
Of course you need line 6O!

60 STOP
If B is not 1O, what does the computer do?

5. You should now have a program that asks for a number and then types out all
the multiples of that number up to 10 times that number. Go ahead - pick a
number and hand in a RUN and a LIST of the program.

6. Can you:

a) Further change the program to add, subtract or divide instead of multiplying?

b) Change the program to print the multiplications or divisions, etc., in a
table form?

c) (Difficult!) Make the computer print the table starting at 1 x 1, going to 1
x 1O, then starting over by itself at 2 x 1, 2 x 2, etc.?

Page 190 << PREVIOUS >> NEXT Jump to page:
Go to contents Go to thumbnails