The following program records student grades
in
English,
French
, science, and mathemetics to a
sequential
data
cassette file.
1 0
INPUT
"
ENTER
N O . O F S T U
DENT
S " ; N
20
D I M N $ CN) , K CN) E CN )
30
D I M R CN ) , S CN)
40
A$
= " G R A
DE
I S "
5 0 F O R X
=1
T O N
60
PR
I
NT:
PRINT
" S
TUDENT
N
O.
" ; X
7 0
INPUT
"
ENTER
S
TUDENT
N
AM
E : " ;
N$
CX)
8 0
PRINT
"
EN
G " ;
A$
; :
INPUT
K CX)
90
PRINT
"
FREN
" ; A
$;
:
INPUT
E CX)
1
00
PRINT
"
SC
I " ;
A$;
INPUT
R
(X)
11
0
PRINT
"
MA
TH
" ; A
$;
:
INPU
T S CX)
1
20
NE
X T X
1
30
WO
PEN
"G
R A
DE
S "
14
0
PRINT
/ T N
15
0 F O R X
=1
T O N
16
0
PRINT
/ T
N$
CX)
17
0
NE
X T X
~Opens
data
file
"GRADES"
for
output
on
cassette tape.)
~Writes
the
number
of
students in the class
to
the file.)
K CX) , E CX) , R CX) , S CX)
1
80
C L
OS
E
~Closes
the cassette file. )
1
90
END
The
following program reads
the
grade
data
written to the cassette file
by
the program shown above,
then calculates displays the grade average
for
each student and class averages for each
of
the
various
subjects.
1 0
ROPEN
" G R A
DE
S "
2 0
INPUT
/ T N
3 0 D
I M N $ CN ) , K CN)
4 0 D
I M R CN ) , S CN)
5 0
F O R X
=1
T O N
~Opens
cassette file "GRADES" for input.)
~Reads
the
number
of
people
in
the class. )
E CN )
Reads
student
names and the grades for
60
INPUT
/ T N $ CX) , K CX)
English.
7 0 I N
PUT
/ T E CX) , R CX) , S CX)
80
NE
X T X
90
C L
OS
E
1
00
PR
I N T T A B C 1
0)
1 1 0
PR
I
NT
T A B C1 5 )
1 2 0
PR
I N T T A B C 2
0)
1 3 0
PRINT
T A B C2
5)
14
0 F O R X
=1
T O N
"
EN
G
"
FREN
"
"
SC
I
"M
ATH
"
Reads the grades
for
French
, science
and mathematics.
~Closes
the file.)
1 5 0
PR
I N T N $ C
X)
; T A B C 1
0)
; K C
X)
1
60
PRINT
T A B C1 5 ) ; E CX)
1
7 0
PR
I N T T A B C 2
0)
; R C
X)
;
1 8 0
PRINT
T A B C2 5 ) ; S CX) ;
1 9 0
PR
I N T T A B C 3
0)
C K C
X)
+ E C
X)
+ R C
X)
+ S C
X)
) / 4
2
00
K
(0)
=K
C0)
+ K CX) : E
(0)
=E
C0)
+E
CX)
21
0 R
C0)
=R
C0)
+R
CX) : S
(0)
= S
(0)
+ S CX)
22
0
NE
X T X
2
30
PRINT
T A B C1
0)
; K
(0)
/ N ; T A B C1 5 ) ; E
(0)
/
N;
24
0 .
PRINT
T A B C2
0)
; R
C0)
/ N ; T A B C2
5)
; S
(0)
/ N
2 5 0
END
70
--
--------
----
--------------------------------------
·
-----------------