home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Monster Media 1994 #1
/
monster.zip
/
monster
/
PROG_BAS
/
PROG914.ZIP
/
PROGRAM.DOC
< prev
next >
Wrap
Text File
|
1994-01-27
|
56KB
|
1,324 lines
PROGRAM.DOC by: Ira F. Kavaler - March & April, 1987
Version 9.14 - 1/27/94
The BASIC Language PROGRAM Generator.
-------------------------------------
I love teaching technical subjects, but I'm not a teacher. I'm an
electrical engineer by trade. While receiving my higher education I
despised computers. I was a radio man; a "ham" (amateur radio)
operator. Based on these early tendencies my first block of technical
training after high school came from RCA Institutes in New York City.
At RCA I took their Advanced Technologies course (T-3) which consisted
of nine terms; the first eight were straight forward Mathematics
(Calculus), English, Science (Physics), Industrial Engineering, and
Electrical and Electronic Theory. The ninth, and last, term was
specialization in either Communications Technology or Computer Science.
Of course, I elected communications! I and my classmates called the
computer kids, "button pushers"!
After graduating from RCA I decided to get my EE degree, so I went
to The Polytechnic Institute of Brooklyn, now masquerading as The
Polytechnic University of New York.
In 1963, while attending Poly, I happened into my public library
one day and, for lack of something better to read, I checked-out a book
on computer programming in machine language. The book was in the RCA
Tutor Series, which was supposed to be a self-learning text; and it
was!
Within days I was writing machine language program for a computer
I didn't even have access to. I was converted to a "button pusher".
The next semester I enrolled in computer classes; Poly had a total of
two: Computer Techniques and Mathematical Techniques; the latter had
very little to do with programming. The language taught was Fortran
IV, and I was writing programs within a day. My professor couldn't
follow the subject matter, complexity, nor logic of my programs by the
second week.
As a class project, I proved by computer simulation that broadcast
color television standards set in the 1950's were wrong; the
modulation compression limits established by the broadcast industry and
the FCC were incorrect.
A second class project was a business inventory and ordering
program for my family's paint business.
By the next semester (1964) my guidance counselor realized my
potential (after "being hit over the head with pleas for computer
time"), so he got me a National Science Foundation grant, and
sponsorship by NASA to do computer programming research. My primary
project was to develop a program to digest vacuum tube and transistor
specifications and characteristic curves for the design of electronic
circuits. I was very successful, having been offered positions by many
large computer companies upon graduation.
I was given access to the newly installed IBM 7040 System, and
time sharing system connected to the GE Datanet, using Darthmouth
BASIC, FORTRAN and ALGOL languages. When Poly replaced the 7040 System
with a new System / 360, I wrote many of the library functions for its
APL (Inversion) language.
While still a student at Poly I started teaching computer
programming classes in additional to the advanced communications
technologies classes I was conducting. I was so successful in getting
other students interested in computer programming that I started
teaching programming to pre-teenagers in my neighborhood.
Upon graduation my family did not was me to move out of New York
City, so I turned down a very lucrative offer by IBM and got a job with
the government; my mother wanted me to have a secure job, and she was
right!
I was always striving to discover the perfect teaching method;
something I'm still trying to do. My teaching techniques progressed to
the point that I could teach a person to write a simple program within
one hour using the six primitive BASIC commands: LET, INPUT, PRINT,
GOTO, IF...THEN, and END.
When I finally got my first home computer* in 1979 (and I resisted
getting one for many years) I was on my way to unlimited computer time.
A couple of years later my boss arranged to get me an IBM XT system.
(* My first machine was a Super Elf 1802 microprocessor on a
single board, followed months later by a TRS-80 Model I, which I still
have in perfect operating condition, amongst other early computer
systems I've been collecting over the years.)
I tough an interesting project would be to write a program that
would allow non-programmers to write fully functional BASIC language
programs with extremely minimal training. To that goal I wrote the
program "PROGRAM", which in 1987 was called simply "PGM".
Some terms I used.
------------------
I tried to explain each of the selections in the two menus:
Instruction and Action. At one point I was stumped! How do I describe
altering the processing path to go back to an earlier point on the
program, or to jump ahead to a later point in the program? I decided
to call the point, either earlier or later, in the program a
"signpost"; it identifies a referenced line number. To identify the
point you erect a signpost.
The term I used to go to the signpost was "detour". When writing
a program you will usually decide to detour to a signpost that has not
been erected yet. That's OK, PROGRAM will ask for an inscription
(label) for that signpost, and use that inscription until it determines
the actual location of the signpost. If you happen to erect the
signpost first, the inscription is still used when any detours to that
signpost are encountered.
Let's try to write a program in BASIC using PROGRAM.
----------------------------------------------------
One of the problem I like to teach as a programming example is the
calculation of the amount of wallpaper required for a room. Having
worked in the paint industry for fifteen years while going to school, I
have discovered the vast majority of people do not know how to
determine how much area a single roll of wallpaper will cover. The
following program development will yield a stand alone BASIC program to
solve this problem.
First read the other documentation file supplied with this
package. It contains the problem broken down into a series of simple
steps. From these simple steps you can draw a simple flow chart that
will diagram these steps. The diagram should look similar to the
following:
┌─────────┐
I have drawn this with │ START │ No command required
only rectangles as └────┬────┘
limited by my word │
processor and printer. ┌──────┴──────┐
│ ASK WIDTH │ Call it W
│ INPUT W │
└──────┬──────┘
│
┌──────┴───────┐
│ ASK LENGTH │ Call it L
│ INPUT L │
└──────┬───────┘
│
┌───────────┴───────────┐
│ CALCULATE PERIMETER │ Call it P
│ P=2*L+2*W │
└───────────┬───────────┘
│
┌──────┴───────┐
│ ASK HEIGHT │ Call it H
│ INPUT H │
└──────┬───────┘
│
┌────────┴─────────┐
│ CALCULATE AREA │ Call it A
│ A=P*H │
└────────┬─────────┘
│
┌─────────┴─────────┐
│ CALCULATE │ The gov't requires
│ NUMBER OF ROLLS │ 30 sq.ft. of paper
│ N=A/30 │ per single roll
└─────────┬─────────┘ Call it N
│
┌──────┴───────┐
│ ASK NUMBER │
│ OF DOORS │ Call it ND
│ INPUT ND │
└──────┬───────┘
│
┌──────┴───────┐
│ ASK NUMBER │
│ OF WINDOWS │ Call it NW
│ INPUT NW │
└──────┬───────┘
│
┌──────────┴───────────┐
│ CALCULATE OPENINGS │ Call it OP
│ OP=ND+NW │
└──────────┬───────────┘
│
┌────────────┴─────────────┐ Adjust number
│ CALCULATE SINGLE ROLLS │ rolls, exclude
│ SR=N-OP/2 │ number openings
└────────────┬─────────────┘ Call it SR
│
┌───────────┴────────────┐
│ DISPLAY ANSWER USING │ The two commands
│ TWO INSTRUCTIONS TO │ allow for more
│ INCLUDING WORDING │ words and place-
│ PRINT SR │ ment chosen
└───────────┬────────────┘
│
┌──┴────┐
│ END │ This command is optional
└───────┘
With the flow chart in hand we can run PROGRAM and start writing
the wallpaper program. When PROGRAM starts it will display the banner
screen, opening screen, and first question dealing with menu
abbreviations. Beginners should select n for no abbreviated menus;
advanced users can select y for abbreviated menus. I have had to
either truncate or word wrap some lines of the program output as
imported into this document:
- - - - - = = = = = PROGRAM output below = = = = = - - - - -
PROGRAM by: Ira F. Kavaler, March & April, 1987
** ** ** ** ** ** ** ** ** ****
** ** ** ** ** **
** ** ** ** **
** ** ** ** **
** ** ** ** ** R O ** ** ** ** R A ** **
** ** ** ** **
** ** ** **
** ** ** ** ** ** **
Do you want abbreviated menus (Y/N) ? n
= = = = = - - - - - End of this portion of output - - - - - = = = = =
The next item displayed will be the action menu. Since we are
starting a new program select action type 1:
- - - - - = = = = = PROGRAM output below = = = = = - - - - -
Select an action from this list:
1 Start a new set of instructions (show instruction menu),
erasing the current set of instructions,
2 LOAD - retrieve a set of instructions previously saved on disk,
erasing the current set of instructions,
3 SAVE - save the current set of instructions on disk,
4 EDIT the instructions by ADDING instructions
after the last current instruction,
5 EDIT the instructions by REPLACING an instruction,
6 EDIT the instructions by DELETING an instruction,
7 EDIT the instructions by INSERTING an instruction
between two current instructions,
8 LIST - display the complete set of instructions on the screen, or
9 Terminate this program and return to a BASIC ready condition.
Select action type (1-9) ? 1
= = = = = - - - - - End of this portion of output - - - - - = = = = =
PROGRAM now need a name for the program to be written. It now
asks for that name. It will use only the first eight characters. We
will enter WALLPAPR to satisfy this condition. The actual filename
will be displayed followed by the instruction menu. Since the first
instruction of our program deals with asking a question, we select
instruction type 1:
- - - - - = = = = = PROGRAM output below = = = = = - - - - -
What is the name of this set of instructions (try to use 8 letters or
less), and if you know what a file extension is, don't use it) ?
wallpapr
The actual filename used on this disk is: WALLPAPR.BAS
Select a type of instruction from this list:
1 INPUT - have the computer ask a question and await a keyboard
answer,
2 LET - have the computer evaluate an arithmetic expression,
evaluate a formula, or define the value of a constant,
3 PRINT - have the computer display a result and/or message, or
skip a line on the screen,
4 IF / THEN - have the computer make a decision based upon a
comparison,
5 (Labelled Line Number) - have the computer erect a signpost,
6 GOTO - have the computer detour to a signpost,
7 END - have the computer stop the processing of instructions,
8 LIST - display the complete list of instructions on the screen, or
9 There are no more instructions at this time; show action menu.
Select instruction type (1-9) ? 1
= = = = = - - - - - End of this portion of output - - - - - = = = = =
This is the INPUT command. Two items are required for this
command. First Is the question you want your wallpaper program to
display when asking the question. The second is the name of the memory
location where the answer to the question will be stored; this is
called a variable, and it is given a one or two letter label
(identification or name). You should choose a label that is associated
with the answer to the question. Since the first question deals with
the width of the room, a logical choice for the label would be W for
width. Once the two piece of information are furnished PROGRAM will
write that instruction. At the start of any program I have generated
four additional instructions that have no effect on the program
operation; they are lines 10 through 50. The INPUT command just
written will be line 50. PROGRAM displays the program created thus
far, with the newly generated line highlighted. The instruction menu
will again be displayed. The second block of the flow chart deals with
an INPUT command so instruction type 1 is chosen again:
- - - - - = = = = = PROGRAM output below = = = = = - - - - -
What question should the computer ask (or press [ENTER] for no
question) ? What is the width of the room
What one or two letter label should the computer use to identify the
answer to the question? w
10 REM *** START *** WALLPAPR.BAS / 01-27-1994 / 08:43:20
20 REM *** This BASIC program was generated by PROGRAM.EXE
30 REM *** A shareware program written by IRA F. KAVALER.
40 KEY OFF: CLS: REM *** Turn off F-key labels & clear screen.
50 INPUT "What is the width of the room";W
Select a type of instruction from this list:
1 INPUT - have the computer ask a question and await a keyboard
answer,
2 LET - have the computer evaluate an arithmetic expression,
evaluate a formula, or define the value of a constant,
3 PRINT - have the computer display a result and/or message, or
skip a line on the screen,
4 IF / THEN - have the computer make a decision based upon a
comparison,
5 (Labelled Line Number) - have the computer erect a signpost,
6 GOTO - have the computer detour to a signpost,
7 END - have the computer stop the processing of instructions,
8 LIST - display the complete list of instructions on the screen, or
9 There are no more instructions at this time; show action menu.
Select instruction type (1-9) ? 1
= = = = = - - - - - End of this portion of output - - - - - = = = = =
Proceed to supply the required information for the length of the
room, logically choosing L for length. The third flow chart block
involves calculating the perimeter of the room from its length and
width. Instruction type 2 does this task and writes the LET command.
The LET command has three purposes: 1. it allows one variable label to
be set equal to another variable label, 2. it allows one variable
label to be set to a constant (number, value), or 3. it allows a
variable label to be set equal to a formula or arithmetic expression.
This latter case is the one needed; that is, P=2*l+2*W
Again two pieces of information are required for the LET command,
the variable label to be calculated or set and the variable label
holding the value, the constant, or (as is the case) the formula. Note
that you do not enter the entire formula, just the two parts. PROGRAM
will assembly the command in the proper order, write the instruction,
list the program thus far, and redisplay the instruction menu:
- - - - - = = = = = PROGRAM output below = = = = = - - - - -
What question should the computer ask (or press [ENTER] for no
question) ? What is the length of the room
What one or two letter label should the computer use to identify the
answer to the question? l
10 REM *** START *** WALLPAPR.BAS / 01-27-1994 / 08:43:20
20 REM *** This BASIC program was generated by PROGRAM.EXE
30 REM *** A shareware program written by IRA F. KAVALER.
40 KEY OFF: CLS: REM *** Turn off F-key labels & clear screen.
50 INPUT "What is the width of the room";W
60 INPUT "What is the length of the room";L
Select a type of instruction from this list:
1 INPUT - have the computer ask a question and await a keyboard
answer,
2 LET - have the computer evaluate an arithmetic expression,
evaluate a formula, or define the value of a constant,
3 PRINT - have the computer display a result and/or message, or
skip a line on the screen,
4 IF / THEN - have the computer make a decision based upon a
comparison,
5 (Labelled Line Number) - have the computer erect a signpost,
6 GOTO - have the computer detour to a signpost,
7 END - have the computer stop the processing of instructions,
8 LIST - display the complete list of instructions on the screen, or
9 There are no more instructions at this time; show action menu.
Select instruction type (1-9) ? 2
What one or two letter label should the computer use to identify the
result of the formula? p
Using one or two letter labels already established, what is the
formula, arithmetic expression, or constant? 2*l+2*w
10 REM *** START *** WALLPAPR.BAS / 01-27-1994 / 08:43:20
20 REM *** This BASIC program was generated by PROGRAM.EXE
30 REM *** A shareware program written by IRA F. KAVALER.
40 KEY OFF: CLS: REM *** Turn off F-key labels & clear screen.
50 INPUT "What is the width of the room";W
60 INPUT "What is the length of the room";L
70 LET P=2*L+2*W
Select a type of instruction from this list:
1 INPUT - have the computer ask a question and await a keyboard
answer,
2 LET - have the computer evaluate an arithmetic expression,
evaluate a formula, or define the value of a constant,
3 PRINT - have the computer display a result and/or message, or
skip a line on the screen,
4 IF / THEN - have the computer make a decision based upon a
comparison,
5 (Labelled Line Number) - have the computer erect a signpost,
6 GOTO - have the computer detour to a signpost,
7 END - have the computer stop the processing of instructions,
8 LIST - display the complete list of instructions on the screen, or
9 There are no more instructions at this time; show action menu.
Select instruction type (1-9) ? 1
= = = = = - - - - - End of this portion of output - - - - - = = = = =
Now it's time to ask for the ceiling height and then calculate the
wall area. These two steps require an INPUT command followed by a LET
command. The formula for the wall area is A=P*H
- - - - - = = = = = PROGRAM output below = = = = = - - - - -
What question should the computer ask (or press [ENTER] for no
question) ? What is the ceiling height
What one or two letter label should the computer use to identify the
answer to the question? h
10 REM *** START *** WALLPAPR.BAS / 01-27-1994 / 08:43:20
20 REM *** This BASIC program was generated by PROGRAM.EXE
30 REM *** A shareware program written by IRA F. KAVALER.
40 KEY OFF: CLS: REM *** Turn off F-key labels & clear screen.
50 INPUT "What is the width of the room";W
60 INPUT "What is the length of the room";L
70 LET P=2*L+2*W
80 INPUT "What is the ceiling height";H
Select a type of instruction from this list:
1 INPUT - have the computer ask a question and await a keyboard
answer,
2 LET - have the computer evaluate an arithmetic expression,
evaluate a formula, or define the value of a constant,
3 PRINT - have the computer display a result and/or message, or
skip a line on the screen,
4 IF / THEN - have the computer make a decision based upon a
comparison,
5 (Labelled Line Number) - have the computer erect a signpost,
6 GOTO - have the computer detour to a signpost,
7 END - have the computer stop the processing of instructions,
8 LIST - display the complete list of instructions on the screen, or
9 There are no more instructions at this time; show action menu.
Select instruction type (1-9) ? 2
What one or two letter label should the computer use to identify the
result of the formula? a
Using one or two letter labels already established, what is the
formula, arithmetic expression, or constant? p*h
10 REM *** START *** WALLPAPR.BAS / 01-27-1994 / 08:43:20
20 REM *** This BASIC program was generated by PROGRAM.EXE
30 REM *** A shareware program written by IRA F. KAVALER.
40 KEY OFF: CLS: REM *** Turn off F-key labels & clear screen.
50 INPUT "What is the width of the room";W
60 INPUT "What is the length of the room";L
70 LET P=2*L+2*W
80 INPUT "What is the ceiling height";H
90 LET A=P*H
Select a type of instruction from this list:
1 INPUT - have the computer ask a question and await a keyboard
answer,
2 LET - have the computer evaluate an arithmetic expression,
evaluate a formula, or define the value of a constant,
3 PRINT - have the computer display a result and/or message, or
skip a line on the screen,
4 IF / THEN - have the computer make a decision based upon a
comparison,
5 (Labelled Line Number) - have the computer erect a signpost,
6 GOTO - have the computer detour to a signpost,
7 END - have the computer stop the processing of instructions,
8 LIST - display the complete list of instructions on the screen, or
9 There are no more instructions at this time; show action menu.
Select instruction type (1-9) ? 2
= = = = = - - - - - End of this portion of output - - - - - = = = = =
The heart of the solution to this program is the fact that the
government regulates the amount of wallpaper in a single roll to 30
square feet. The LET command to hold this arithmetic expression is now
generated in another LET command:
- - - - - = = = = = PROGRAM output below = = = = = - - - - -
What one or two letter label should the computer use to identify the
result of the formula? n
Using one or two letter labels already established, what is the
formula, arithmetic expression, or constant? a/30
10 REM *** START *** WALLPAPR.BAS / 01-27-1994 / 08:43:20
20 REM *** This BASIC program was generated by PROGRAM.EXE
30 REM *** A shareware program written by IRA F. KAVALER.
40 KEY OFF: CLS: REM *** Turn off F-key labels & clear screen.
50 INPUT "What is the width of the room";W
60 INPUT "What is the length of the room";L
70 LET P=2*L+2*W
80 INPUT "What is the ceiling height";H
90 LET A=P*H
100 LET N=A/30
Select a type of instruction from this list:
1 INPUT - have the computer ask a question and await a keyboard
answer,
2 LET - have the computer evaluate an arithmetic expression,
evaluate a formula, or define the value of a constant,
3 PRINT - have the computer display a result and/or message, or
skip a line on the screen,
4 IF / THEN - have the computer make a decision based upon a
comparison,
5 (Labelled Line Number) - have the computer erect a signpost,
6 GOTO - have the computer detour to a signpost,
7 END - have the computer stop the processing of instructions,
8 LIST - display the complete list of instructions on the screen, or
9 There are no more instructions at this time; show action menu.
Select instruction type (1-9) ? 1
= = = = = - - - - - End of this portion of output - - - - - = = = = =
Every room must have at least one door! You will not be using any
wallpaper over on that door. Every average sized door and window each
has the same wall area as one half roll of wallpaper. Thus, find the
number of doors and windows in the room with two INPUT commands. Add
these two numbers to get the total number of openings in the room in a
LET command, and subtract 1/2 a roll for each opening. Call this the
single rolls, as computer in another LET command:
- - - - - = = = = = PROGRAM output below = = = = = - - - - -
What question should the computer ask (or press [ENTER] for no
question) ? How many doors are there
What one or two letter label should the computer use to identify the
answer to the question? nd
10 REM *** START *** WALLPAPR.BAS / 01-27-1994 / 08:43:20
20 REM *** This BASIC program was generated by PROGRAM.EXE
30 REM *** A shareware program written by IRA F. KAVALER.
40 KEY OFF: CLS: REM *** Turn off F-key labels & clear screen.
50 INPUT "What is the width of the room";W
60 INPUT "What is the length of the room";L
70 LET P=2*L+2*W
80 INPUT "What is the ceiling height";H
90 LET A=P*H
100 LET N=A/30
110 INPUT "How many doors are there";ND
Select a type of instruction from this list:
1 INPUT - have the computer ask a question and await a keyboard
answer,
2 LET - have the computer evaluate an arithmetic expression,
evaluate a formula, or define the value of a constant,
3 PRINT - have the computer display a result and/or message, or
skip a line on the screen,
4 IF / THEN - have the computer make a decision based upon a
comparison,
5 (Labelled Line Number) - have the computer erect a signpost,
6 GOTO - have the computer detour to a signpost,
7 END - have the computer stop the processing of instructions,
8 LIST - display the complete list of instructions on the screen, or
9 There are no more instructions at this time; show action menu.
Select instruction type (1-9) ? 1
What question should the computer ask (or press [ENTER] for no
question) ? How many windows are there
What one or two letter label should the computer use to identify the
answer to the question? nw
10 REM *** START *** WALLPAPR.BAS / 01-27-1994 / 08:43:20
20 REM *** This BASIC program was generated by PROGRAM.EXE
30 REM *** A shareware program written by IRA F. KAVALER.
40 KEY OFF: CLS: REM *** Turn off F-key labels & clear screen.
50 INPUT "What is the width of the room";W
60 INPUT "What is the length of the room";L
70 LET P=2*L+2*W
80 INPUT "What is the ceiling height";H
90 LET A=P*H
100 LET N=A/30
110 INPUT "How many doors are there";ND
120 INPUT "How many windows are there";NW
Select a type of instruction from this list:
1 INPUT - have the computer ask a question and await a keyboard
answer,
2 LET - have the computer evaluate an arithmetic expression,
evaluate a formula, or define the value of a constant,
3 PRINT - have the computer display a result and/or message, or
skip a line on the screen,
4 IF / THEN - have the computer make a decision based upon a
comparison,
5 (Labelled Line Number) - have the computer erect a signpost,
6 GOTO - have the computer detour to a signpost,
7 END - have the computer stop the processing of instructions,
8 LIST - display the complete list of instructions on the screen, or
9 There are no more instructions at this time; show action menu.
Select instruction type (1-9) ? 2
What one or two letter label should the computer use to identify the
result of the formula? op
Using one or two letter labels already established, what is the
formula, arithmetic expression, or constant? nd+nw
10 REM *** START *** WALLPAPR.BAS / 01-27-1994 / 08:43:20
20 REM *** This BASIC program was generated by PROGRAM.EXE
30 REM *** A shareware program written by IRA F. KAVALER.
40 KEY OFF: CLS: REM *** Turn off F-key labels & clear screen.
50 INPUT "What is the width of the room";W
60 INPUT "What is the length of the room";L
70 LET P=2*L+2*W
80 INPUT "What is the ceiling height";H
90 LET A=P*H
100 LET N=A/30
110 INPUT "How many doors are there";ND
120 INPUT "How many windows are there";NW
130 LET OP=ND+NW
Select a type of instruction from this list:
1 INPUT - have the computer ask a question and await a keyboard
answer,
2 LET - have the computer evaluate an arithmetic expression,
evaluate a formula, or define the value of a constant,
3 PRINT - have the computer display a result and/or message, or
skip a line on the screen,
4 IF / THEN - have the computer make a decision based upon a
comparison,
5 (Labelled Line Number) - have the computer erect a signpost,
6 GOTO - have the computer detour to a signpost,
7 END - have the computer stop the processing of instructions,
8 LIST - display the complete list of instructions on the screen, or
9 There are no more instructions at this time; show action menu.
Select instruction type (1-9) ? 2
What one or two letter label should the computer use to identify the
result of the formula? sr
Using one or two letter labels already established, what is the
formula, arithmetic expression, or constant? n-op/2
10 REM *** START *** WALLPAPR.BAS / 01-27-1994 / 08:43:20
20 REM *** This BASIC program was generated by PROGRAM.EXE
30 REM *** A shareware program written by IRA F. KAVALER.
40 KEY OFF: CLS: REM *** Turn off F-key labels & clear screen.
50 INPUT "What is the width of the room";W
60 INPUT "What is the length of the room";L
70 LET P=2*L+2*W
80 INPUT "What is the ceiling height";H
90 LET A=P*H
100 LET N=A/30
110 INPUT "How many doors are there";ND
120 INPUT "How many windows are there";NW
130 LET OP=ND+NW
140 LET SR=N-OP/2
Select a type of instruction from this list:
1 INPUT - have the computer ask a question and await a keyboard
answer,
2 LET - have the computer evaluate an arithmetic expression,
evaluate a formula, or define the value of a constant,
3 PRINT - have the computer display a result and/or message, or
skip a line on the screen,
4 IF / THEN - have the computer make a decision based upon a
comparison,
5 (Labelled Line Number) - have the computer erect a signpost,
6 GOTO - have the computer detour to a signpost,
7 END - have the computer stop the processing of instructions,
8 LIST - display the complete list of instructions on the screen, or
9 There are no more instructions at this time; show action menu.
Select instruction type (1-9) ? 3
= = = = = - - - - - End of this portion of output - - - - - = = = = =
With all the necessary calculation completed it's time to display
the results. This requires the PRINT command. The PRINT command can
be used in four different ways: 1. to display only the value, 2. to
display a message and the value, 3. to display only a message, and 4.
to display a blank line (for clarity of display).
Let's use two PRINT commands to display the answer as follows:
- - - - - = = = = = PROGRAM output below = = = = = - - - - -
Do you want to display ONLY a message or skip a line (Y/N) ? n
What one or two letter label should the computer display on the screen?
sr
What message should the computer put before the label
(press [ENTER] to omit message or skip a line)
? You will need
10 REM *** START *** WALLPAPR.BAS / 01-27-1994 / 08:43:20
20 REM *** This BASIC program was generated by PROGRAM.EXE
30 REM *** A shareware program written by IRA F. KAVALER.
40 KEY OFF: CLS: REM *** Turn off F-key labels & clear screen.
50 INPUT "What is the width of the room";W
60 INPUT "What is the length of the room";L
70 LET P=2*L+2*W
80 INPUT "What is the ceiling height";H
90 LET A=P*H
100 LET N=A/30
110 INPUT "How many doors are there";ND
120 INPUT "How many windows are there";NW
130 LET OP=ND+NW
140 LET SR=N-OP/2
150 PRINT "You will need";SR
Select a type of instruction from this list:
1 INPUT - have the computer ask a question and await a keyboard
answer,
2 LET - have the computer evaluate an arithmetic expression,
evaluate a formula, or define the value of a constant,
3 PRINT - have the computer display a result and/or message, or
skip a line on the screen,
4 IF / THEN - have the computer make a decision based upon a
comparison,
5 (Labelled Line Number) - have the computer erect a signpost,
6 GOTO - have the computer detour to a signpost,
7 END - have the computer stop the processing of instructions,
8 LIST - display the complete list of instructions on the screen, or
9 There are no more instructions at this time; show action menu.
Select instruction type (1-9) ? 3
Do you want to display ONLY a message or skip a line (Y/N) ? y
What message should the computer put before the label
(press [ENTER] to omit message or skip a line)
? single rolls of wallpaper.
10 REM *** START *** WALLPAPR.BAS / 01-27-1994 / 08:43:20
20 REM *** This BASIC program was generated by PROGRAM.EXE
30 REM *** A shareware program written by IRA F. KAVALER.
40 KEY OFF: CLS: REM *** Turn off F-key labels & clear screen.
50 INPUT "What is the width of the room";W
60 INPUT "What is the length of the room";L
70 LET P=2*L+2*W
80 INPUT "What is the ceiling height";H
90 LET A=P*H
100 LET N=A/30
110 INPUT "How many doors are there";ND
120 INPUT "How many windows are there";NW
130 LET OP=ND+NW
140 LET SR=N-OP/2
150 PRINT "You will need";SR
160 PRINT "single rolls of wallpaper."
Select a type of instruction from this list:
1 INPUT - have the computer ask a question and await a keyboard
answer,
2 LET - have the computer evaluate an arithmetic expression,
evaluate a formula, or define the value of a constant,
3 PRINT - have the computer display a result and/or message, or
skip a line on the screen,
4 IF / THEN - have the computer make a decision based upon a
comparison,
5 (Labelled Line Number) - have the computer erect a signpost,
6 GOTO - have the computer detour to a signpost,
7 END - have the computer stop the processing of instructions,
8 LIST - display the complete list of instructions on the screen, or
9 There are no more instructions at this time; show action menu.
Select instruction type (1-9) ? 7
= = = = = - - - - - End of this portion of output - - - - - = = = = =
The program is finished! We now can optionally put an END command
after the last instruction:
- - - - - = = = = = PROGRAM output below = = = = = - - - - -
10 REM *** START *** WALLPAPR.BAS / 01-27-1994 / 08:43:20
20 REM *** This BASIC program was generated by PROGRAM.EXE
30 REM *** A shareware program written by IRA F. KAVALER.
40 KEY OFF: CLS: REM *** Turn off F-key labels & clear screen.
50 INPUT "What is the width of the room";W
60 INPUT "What is the length of the room";L
70 LET P=2*L+2*W
80 INPUT "What is the ceiling height";H
90 LET A=P*H
100 LET N=A/30
110 INPUT "How many doors are there";ND
120 INPUT "How many windows are there";NW
130 LET OP=ND+NW
140 LET SR=N-OP/2
150 PRINT "You will need";SR
160 PRINT "single rolls of wallpaper."
170 END
Select a type of instruction from this list:
1 INPUT - have the computer ask a question and await a keyboard
answer,
2 LET - have the computer evaluate an arithmetic expression,
evaluate a formula, or define the value of a constant,
3 PRINT - have the computer display a result and/or message, or
skip a line on the screen,
4 IF / THEN - have the computer make a decision based upon a
comparison,
5 (Labelled Line Number) - have the computer erect a signpost,
6 GOTO - have the computer detour to a signpost,
7 END - have the computer stop the processing of instructions,
8 LIST - display the complete list of instructions on the screen, or
9 There are no more instructions at this time; show action menu.
Select instruction type (1-9) ? 9
= = = = = - - - - - End of this portion of output - - - - - = = = = =
To leave the instruction menu and go to the action menu selection
instruction type 9 which is the "escape clause"!
- - - - - = = = = = PROGRAM output below = = = = = - - - - -
Select an action from this list:
1 Start a new set of instructions (show instruction menu),
erasing the current set of instructions,
2 LOAD - retrieve a set of instructions previously saved on disk,
erasing the current set of instructions,
3 SAVE - save the current set of instructions on disk,
4 EDIT the instructions by ADDING instructions
after the last current instruction,
5 EDIT the instructions by REPLACING an instruction,
6 EDIT the instructions by DELETING an instruction,
7 EDIT the instructions by INSERTING an instruction
between two current instructions,
8 LIST - display the complete set of instructions on the screen, or
9 Terminate this program and return to a BASIC ready condition.
Select action type (1-9) ? 3
= = = = = - - - - - End of this portion of output - - - - - = = = = =
At the action menu the newly generated wallpaper program can be
saved to disk by selection action type 3. IF desired, the program name
can be changed before saving, or by just pressing the ENTER key, the
already established name WALLPAPR will be used:
- - - - - = = = = = PROGRAM output below = = = = = - - - - -
To use the existing filename WALLPAPR, press [Enter], or
what is the name of this set of instructions (try to use 8 letters or
less), and if you know what a file extension is, don't use it) ?
The existing filename: WALLPAPR is being used.
The actual filename used on this disk is: WALLPAPR.BAS
File open.................File closed.
10 REM *** START *** WALLPAPR.BAS / 01-27-1994 / 08:43:20
20 REM *** This BASIC program was generated by PROGRAM.EXE
30 REM *** A shareware program written by IRA F. KAVALER.
40 KEY OFF: CLS: REM *** Turn off F-key labels & clear screen.
50 INPUT "What is the width of the room";W
60 INPUT "What is the length of the room";L
70 LET P=2*L+2*W
80 INPUT "What is the ceiling height";H
90 LET A=P*H
100 LET N=A/30
110 INPUT "How many doors are there";ND
120 INPUT "How many windows are there";NW
130 LET OP=ND+NW
140 LET SR=N-OP/2
150 PRINT "You will need";SR
160 PRINT "single rolls of wallpaper."
170 END
Press [any key] to continue...
Select an action from this list:
1 Start a new set of instructions (show instruction menu),
erasing the current set of instructions,
2 LOAD - retrieve a set of instructions previously saved on disk,
erasing the current set of instructions,
3 SAVE - save the current set of instructions on disk,
4 EDIT the instructions by ADDING instructions
after the last current instruction,
5 EDIT the instructions by REPLACING an instruction,
6 EDIT the instructions by DELETING an instruction,
7 EDIT the instructions by INSERTING an instruction
between two current instructions,
8 LIST - display the complete set of instructions on the screen, or
9 Terminate this program and return to a BASIC ready condition.
Select action type (1-9) ? 8
= = = = = - - - - - End of this portion of output - - - - - = = = = =
From either the instruction menu or the action menu you can
display the program being generated by selecting type 8:
- - - - - = = = = = PROGRAM output below = = = = = - - - - -
10 REM *** START *** WALLPAPR.BAS / 01-27-1994 / 08:43:20
20 REM *** This BASIC program was generated by PROGRAM.EXE
30 REM *** A shareware program written by IRA F. KAVALER.
40 KEY OFF: CLS: REM *** Turn off F-key labels & clear screen.
50 INPUT "What is the width of the room";W
60 INPUT "What is the length of the room";L
70 LET P=2*L+2*W
80 INPUT "What is the ceiling height";H
90 LET A=P*H
100 LET N=A/30
110 INPUT "How many doors are there";ND
120 INPUT "How many windows are there";NW
130 LET OP=ND+NW
140 LET SR=N-OP/2
150 PRINT "You will need";SR
160 PRINT "single rolls of wallpaper."
170 END
Press [any key] to continue...
Select an action from this list:
1 Start a new set of instructions (show instruction menu),
erasing the current set of instructions,
2 LOAD - retrieve a set of instructions previously saved on disk,
erasing the current set of instructions,
3 SAVE - save the current set of instructions on disk,
4 EDIT the instructions by ADDING instructions
after the last current instruction,
5 EDIT the instructions by REPLACING an instruction,
6 EDIT the instructions by DELETING an instruction,
7 EDIT the instructions by INSERTING an instruction
between two current instructions,
8 LIST - display the complete set of instructions on the screen, or
9 Terminate this program and return to a BASIC ready condition.
Select action type (1-9) ? 7
= = = = = - - - - - End of this portion of output - - - - - = = = = =
Whenever you write a program you always find points that you
missed or want to enhance. Two I found afterwards. First, the user
should be told that the dimensions of the room must be given in feet.
Second, it would be nice to leave a blank line just before the program
gives the answer to the problem.
PROGRAM has the ability to edit the program being created. Line
can be deleted, new lines can be added, and lines can be replaced. The
action menu has these options available. Action type 3 allows adding
instruction in between existing instructions. Use this twice to add
the enhancements outlined above:
- - - - - = = = = = PROGRAM output below = = = = = - - - - -
Find the number in front of the instruction before which you want to
INSERT:
10 REM *** START *** WALLPAPR.BAS / 01-27-1994 / 08:43:20
20 REM *** This BASIC program was generated by PROGRAM.EXE
30 REM *** A shareware program written by IRA F. KAVALER.
40 KEY OFF: CLS: REM *** Turn off F-key labels & clear screen.
50 INPUT "What is the width of the room";W
60 INPUT "What is the length of the room";L
70 LET P=2*L+2*W
80 INPUT "What is the ceiling height";H
90 LET A=P*H
100 LET N=A/30
110 INPUT "How many doors are there";ND
120 INPUT "How many windows are there";NW
130 LET OP=ND+NW
140 LET SR=N-OP/2
150 PRINT "You will need";SR
160 PRINT "single rolls of wallpaper."
170 END
What is the number before the one to be INSERTED? 40
40 KEY OFF: CLS: REM *** Turn off F-key labels & clear screen.
Are you sure (Y/N) ? y
What is the new inserted instruction?
Select a type of instruction from this list:
1 INPUT - have the computer ask a question and await a keyboard
answer,
2 LET - have the computer evaluate an arithmetic expression,
evaluate a formula, or define the value of a constant,
3 PRINT - have the computer display a result and/or message, or
skip a line on the screen,
4 IF / THEN - have the computer make a decision based upon a
comparison,
5 (Labelled Line Number) - have the computer erect a signpost,
6 GOTO - have the computer detour to a signpost,
7 END - have the computer stop the processing of instructions,
8 LIST - display the complete list of instructions on the screen, or
9 There are no more instructions at this time; show action menu.
Select instruction type (1-9) ? 3
Do you want to display ONLY a message or skip a line (Y/N) ? y
What message should the computer put before the label
(press [ENTER] to omit message or skip a line)
? Enter the room size in feet.
10 REM *** START *** WALLPAPR.BAS / 01-27-1994 / 08:43:20
20 REM *** This BASIC program was generated by PROGRAM.EXE
30 REM *** A shareware program written by IRA F. KAVALER.
40 KEY OFF: CLS: REM *** Turn off F-key labels & clear screen.
45 PRINT "Enter the room size in feet."
INSERTED
Select an action from this list:
1 Start a new set of instructions (show instruction menu),
erasing the current set of instructions,
2 LOAD - retrieve a set of instructions previously saved on disk,
erasing the current set of instructions,
3 SAVE - save the current set of instructions on disk,
4 EDIT the instructions by ADDING instructions
after the last current instruction,
5 EDIT the instructions by REPLACING an instruction,
6 EDIT the instructions by DELETING an instruction,
7 EDIT the instructions by INSERTING an instruction
between two current instructions,
8 LIST - display the complete set of instructions on the screen, or
9 Terminate this program and return to a BASIC ready condition.
Select action type (1-9) ? 7
Find the number in front of the instruction before which you want to
INSERT:
10 REM *** START *** WALLPAPR.BAS / 01-27-1994 / 08:43:20
20 REM *** This BASIC program was generated by PROGRAM.EXE
30 REM *** A shareware program written by IRA F. KAVALER.
40 KEY OFF: CLS: REM *** Turn off F-key labels & clear screen.
45 PRINT "Enter the room size in feet."
50 INPUT "What is the width of the room";W
60 INPUT "What is the length of the room";L
70 LET P=2*L+2*W
80 INPUT "What is the ceiling height";H
90 LET A=P*H
100 LET N=A/30
110 INPUT "How many doors are there";ND
120 INPUT "How many windows are there";NW
130 LET OP=ND+NW
140 LET SR=N-OP/2
150 PRINT "You will need";SR
160 PRINT "single rolls of wallpaper."
170 END
What is the number before the one to be INSERTED? 140
140 LET SR=N-OP/2
Are you sure (Y/N) ? y
What is the new inserted instruction?
Select a type of instruction from this list:
1 INPUT - have the computer ask a question and await a keyboard
answer,
2 LET - have the computer evaluate an arithmetic expression,
evaluate a formula, or define the value of a constant,
3 PRINT - have the computer display a result and/or message, or
skip a line on the screen,
4 IF / THEN - have the computer make a decision based upon a
comparison,
5 (Labelled Line Number) - have the computer erect a signpost,
6 GOTO - have the computer detour to a signpost,
7 END - have the computer stop the processing of instructions,
8 LIST - display the complete list of instructions on the screen, or
9 There are no more instructions at this time; show action menu.
Select instruction type (1-9) ? 3
Do you want to display ONLY a message or skip a line (Y/N) ? y
What message should the computer put before the label
(press [ENTER] to omit message or skip a line)
?
10 REM *** START *** WALLPAPR.BAS / 01-27-1994 / 08:43:20
20 REM *** This BASIC program was generated by PROGRAM.EXE
30 REM *** A shareware program written by IRA F. KAVALER.
40 KEY OFF: CLS: REM *** Turn off F-key labels & clear screen.
45 PRINT "Enter the room size in feet."
50 INPUT "What is the width of the room";W
60 INPUT "What is the length of the room";L
70 LET P=2*L+2*W
80 INPUT "What is the ceiling height";H
90 LET A=P*H
100 LET N=A/30
110 INPUT "How many doors are there";ND
120 INPUT "How many windows are there";NW
130 LET OP=ND+NW
140 LET SR=N-OP/2
145 PRINT
INSERTED
Select an action from this list:
1 Start a new set of instructions (show instruction menu),
erasing the current set of instructions,
2 LOAD - retrieve a set of instructions previously saved on disk,
erasing the current set of instructions,
3 SAVE - save the current set of instructions on disk,
4 EDIT the instructions by ADDING instructions
after the last current instruction,
5 EDIT the instructions by REPLACING an instruction,
6 EDIT the instructions by DELETING an instruction,
7 EDIT the instructions by INSERTING an instruction
between two current instructions,
8 LIST - display the complete set of instructions on the screen, or
9 Terminate this program and return to a BASIC ready condition.
Select action type (1-9) ? 3
= = = = = - - - - - End of this portion of output - - - - - = = = = =
The newly edited program will have to be saved again. Selection
action type 3 again to do this:
- - - - - = = = = = PROGRAM output below = = = = = - - - - -
To use the existing filename WALLPAPR, press [Enter], or
what is the name of this set of instructions (try to use 8 letters or
less), and if you know what a file extension is, don't use it) ?
The existing filename: WALLPAPR is being used.
The actual filename used on this disk is: WALLPAPR.BAS
File open...................File closed.
10 REM *** START *** WALLPAPR.BAS / 01-27-1994 / 08:43:20
20 REM *** This BASIC program was generated by PROGRAM.EXE
30 REM *** A shareware program written by IRA F. KAVALER.
40 KEY OFF: CLS: REM *** Turn off F-key labels & clear screen.
45 PRINT "Enter the room size in feet."
50 INPUT "What is the width of the room";W
60 INPUT "What is the length of the room";L
70 LET P=2*L+2*W
80 INPUT "What is the ceiling height";H
90 LET A=P*H
100 LET N=A/30
110 INPUT "How many doors are there";ND
120 INPUT "How many windows are there";NW
130 LET OP=ND+NW
140 LET SR=N-OP/2
145 PRINT
150 PRINT "You will need";SR
160 PRINT "single rolls of wallpaper."
170 END
Press [any key] to continue...
Select an action from this list:
1 Start a new set of instructions (show instruction menu),
erasing the current set of instructions,
2 LOAD - retrieve a set of instructions previously saved on disk,
erasing the current set of instructions,
3 SAVE - save the current set of instructions on disk,
4 EDIT the instructions by ADDING instructions
after the last current instruction,
5 EDIT the instructions by REPLACING an instruction,
6 EDIT the instructions by DELETING an instruction,
7 EDIT the instructions by INSERTING an instruction
between two current instructions,
8 LIST - display the complete set of instructions on the screen, or
9 Terminate this program and return to a BASIC ready condition.
Select action type (1-9) ? 9
= = = = = - - - - - End of this portion of output - - - - - = = = = =
The WALLPAPR program is done for the time being. Choose action
type 9 to quit PROGRAM.
The files generated by PROGRAM can be LOADed under BASICA and run
independently of PROGRAM. If the generated file is re-SAVEd under
BASICA in the ASCII format; that is, using SAVE"file",a it can be
reloaded under PROGRAM and edited.
I tried to make PROGRAM self explanatory but it's hard for me to
tell if I was successful. I don't think it is as easy to use as I
wanted, but then neither is programming a VCR! (I'm very good at that
too!)
There are some limitations, especially in error trapping, in the
program:
1. No attempt is made to analyze the arithmetic formula or
expression, variable or constant that supplies a value to the LET
command.
2. No attempt is made to analyze the logical expression in the
IF...THEN command.
3. String, integer and double precision variables and constants are
not supported.
4. Arrays (vectors; dimensioned, subscripted variables) are not
supported.
Why not try it and let me know how you make out. To help where I
may have fallen short, I have included additional documentation file(s)
which were a manuscript for a computer manual I wrote a decade ago for
classes I was teaching on the Commodore VIC-20 and 64 systems. I have
quickly edited the manuscript for the IBM system. The manual was not
meant to be used alone, but with PROGRAM it should be complete.
Here's the small print.
-----------------------
All versions of this program including its related files are being
distributed on an "AS IS" basis. There is absolutely no stated or
implied guarantee or warrantee of usability for any purpose or
correctness of the formulas and procedures contained in any file.
If you happen to discover an error in the program I will make
every attempt to correct the error as quickly as possible. I am under
no obligation to replace nor make refunds for defective full versions
or demonstration/trial versions of the program. I have to take this
posture as my cost to make even the simplest of corrections far
outweighs any monetary compensation received for the full version of
the program.
If you require any special modifications to the program I will be
happy to discuss on an individual basis the cost of supplying modified
programs and documentation.
The program was tested on Tandy models 1000 and 1000 SX using MS-
DOS 3.3; IBM PS/2 models 50 and 80, using PC-DOS 3.3; and a Compaq
Desk-Pro 486/33 using MS-DOS 6.0.
And now a word from our sponsor.
--------------------------------
You can get the latest version of this program by registering the
program. When you register I will also include any other demonstration
/ trail programs that I have available. Please send $20.00 for an IBM
compatible 5-1/4 or 3-1/2 inch 720 DS/DD or HD disk(s), your choice,
to:
IRA F. KAVALER
671 East 78 Street
Brooklyn, New York 11236
All inquiries that do not include the registration fee must be
accompanied by a stamped self addressed return envelope.
I reserve the right to discontinue support for, change the terms,
or withdraw any part or all of this offer including but not limited to
the programs and its associated files at any time without giving prior
notice.
No form of this program, registered or unregistered, may be used
in commercial, educational, nor governmental applications without
written authorization or a site lease from the author; such
authorization and/or site lease may require that a substantial fee be
paid to the author.
73's, de WA2ZIR.
----------------
I welcome your suggestions and comments about this product and
others. I won't promise that good suggestions will be added to the
program, but they will be considered.
Thank you.
Appendix.
---------
The operating systems, programs and companies mentioned in this file:
PKWARE, PKZIP, PKUNZIP, MS-DOS, PC-DOS, LIST, BROWSE, SIMCGA, Hercules,
Tandy Compaq, Arche, and IBM are all copyrights, trademarks, and/or
service marks of other individuals or other corporations.
>>>>> End of File <<<<<