May June 1980 - Commodore Computers
May June 1980 - Commodore Computers
May June 1980 - Commodore Computers
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
'VlA MAY/JUNE. Y I <strong>1980</strong> 198O ISSUE 4 A COMPUTE. 69<br />
In lhil thh ISSllr, issue, J/llrlerle Marlmt I'mllo Pmtiu amlillllll continues /itr her/JrtUlIlalioTl presentation of the .I:radi".1!. gradingprogram<br />
lshown llUll-'1l i1l m hIssue SIl,. 3's 3 C/Jlumll. column, 711 '/'his time tape (Illd anddisl.. dish data Jtomge storage 0/)/1011$ upturns are<br />
added. Re RCLL<br />
The Learning Lab<br />
Marlene Protto<br />
Pratfo<br />
This grading program originated on a 32 K PET<br />
This grading program originated on a 32K PET<br />
withoUl without a printer. Its major idea was to mail1lain<br />
maintain<br />
the information in thee machine in arrays for easy<br />
reviewing and recording of thee results by hand. Op·<br />
lions tions are now provided for storingg and retrieving eving the<br />
partial or full term data on tape or disk (tape refers to<br />
partial or full term data on tape or disk (tape refers to<br />
cassette tape 110 I/O and disk refers to the CBM 2040 disk<br />
drive 110 , whil e 110 refers to input/output opera<br />
drive I/O. while I/O refers to input/output opera<br />
ti0l1S).<br />
tions).<br />
The user is asked how the data will be entered<br />
The user is asked how the data will be entered<br />
(statements 2905-2907) and there is a new item in thee<br />
menu (s tatements 27620-27640) allowing th e data to be<br />
menu (statements 27620-27640) allowing the data to be<br />
saved. Of the numeric data, only thee raw student<br />
grades are stored. When thee data is read from tape or<br />
disk thee user r may choose to add grades if the total<br />
number of grades will not exceed thee maximum in<br />
2150. The averages, z scores, and frequencies encies are then<br />
recalculated and the menu presented.<br />
.<br />
As thee average are calculated, thee user is asked<br />
is the average is "okay". If a change is needed and<br />
the inpUl input came from tape orr disk, all off the current<br />
scores are printed to refresh the user's memory<br />
(statements 13200-13560). 3560). If the user wants to review<br />
the grades, he/she may ask to change one grade and<br />
merelyy input the same mc value. Note that a change of<br />
input method was made here in order to speed up<br />
the program (13250). If you prefer using the return<br />
key, do not make this s change.<br />
The instructions concerning g grade changes have<br />
been modified. For r each student the user may Illay<br />
change all grades or one grade at a time (13600-<br />
change all grades or one grade at a time ( 13600-<br />
14000).<br />
14000).<br />
Since the scores may come from more than one<br />
input source, two twO variables are needed to keep track<br />
of the number of grades from frolll each. A new variable<br />
NN is used for the number of grades entered<br />
NN is used for th e number of grades entered<br />
initially and NP is th e number of grades added on a<br />
initially and NP is the number of grades added on a<br />
subsequent run. . In the first case N =NN= N<br />
and in<br />
the second case N = N N + N P.<br />
the second case N ~ I N + NP.<br />
Writing the Data File<br />
Observe statements 36010-36097. RV Rv is a variable<br />
which points to where the program should continue cO lllinue<br />
if there is an I/O 110 problem and IT refers to disk<br />
or o r tape. The filename and an indicator for r tape or o r<br />
the disk drive number are requested.<br />
The form of the OPEN statement is OPEN<br />
parml, parmi, parm2, parm3, parm4 pann4 where parml I is the<br />
logical file number, parm 2 is the device number<br />
(DV), (Dv), parm3 is the secondary address (SA), and parm4<br />
is the c filename and/or commands. cO lllmands. The variables, DV<br />
and SA, are arc assigned differently for tape or disk<br />
(36024 & 36028). The disk filename is modified as<br />
shown in 36028. 36028, The fourth parameter consists of the<br />
drive nUllIber number (either 0 ur or I) 1) lo followed by a<br />
: (colon),<br />
the e name provided by the e user and finally indicators<br />
for SEQuential file type aand WRITE mode of operation.<br />
In additiun addition, . forr disk 110. I/O, we OPEN OPKN the com· comerrorr<br />
channel in order to check for disk eerrors.<br />
rs .<br />
We choose to use file number 2 and we must use<br />
Secondary Address 15. Some form of initialization<br />
of the disk drive muSt must occur. It is included in the<br />
OPEN command by using g ""I" I " + HS H$ as the fourth<br />
parameter where H$ is the disk drive number provided<br />
by the user. (We are assuming that the diskette<br />
has been formatted at this pain!.)<br />
point.)<br />
Tape fil filee writing is indicated by a Secondary<br />
Address of I. 1. Disk filee writing is indicated by filee<br />
type (SEQ) and mode (WRITE) which arc are part of the<br />
fourth parameter in the OPEN statement. In either<br />
case, the first parameter is the filee number which<br />
will later appear after the # in the PRINT#<br />
statements. nt s .<br />
IT is checked in 36032. If thee userr has not<br />
responded with Tor T 0 orr 1, thee program relUrn returnss<br />
to 36022 to elicit the proper resonse.<br />
Information is written to the external medium in<br />
the following ow g order: I) 1) filee identifier (32 characters<br />
or less off information), n), 2) number of students, , 3)<br />
number of grades per student, and 4) a character<br />
(0$) (DS) to indicate whether identifiers have been provided<br />
by the user or if sequence numbers will be written<br />
as identifiers.<br />
For r each cach student slUdclll an identifier or sequence ence number<br />
and the e student's grades are written. After the last(Jth)<br />
stUth)<br />
student's data, , DONE E is written. The user is informed<br />
when the file e writing is completed complcted and is returned relUrned<br />
to the menu.<br />
Reading the Data File<br />
e<br />
The 'rhe program asks s how data is to be read<br />
(2905-2907). If the data comes from tape or disk, the<br />
filename is entered ered (2925), and the e DeVice number<br />
and a Secondary Address are arc set (2930-2935).<br />
Tape file reading is indicated by a Secondary<br />
Address of O. For di sk, the founh parameter is<br />
Address of 0. For disk, the fourth parameter is<br />
similar to that for writing, except that the mode is<br />
replaced by READ. The error channel is opened and<br />
the disk drive is initialized (this s may occur twice in<br />
the program since the e read and write portions are<br />
independent of each other and a the user may choose<br />
any y of several combinations of I/O 110 options.) File<br />
1I is opened for either disk d or tape reading. Student<br />
data are arc read in 10250 and 11560.<br />
Data as Character Strings<br />
The data are written as character strings. On input<br />
the data are read as character strings and converted<br />
to numeric data as needed. Microsoft BASIC provides<br />
two functions for converting convening data from numeric<br />
to character characler and character to numeric. . STR$(numeric<br />
variable) will convert a number to a string, slrin while<br />
VAL(string V variable) will convert a string to a number.