Exercise For Chapter 8. Setting Up Your Own Format-Print Using; And Image Statements - IBM 5110 Basic Introduction

Table of Contents

Advertisement

C " . ' " . "
"
C
'~"'"
/
c
c
Exercise for Chapter 8. Setting Up Your Own Format-PRINT USING
and Image Statements
You are a teacher and you want to write a program that will figure out
and print a report of grades for each student at the end of the term.
There have been three exams during the term, and a final exam. The
grade for the term will be a letter grade based on an average of the
exam scores according to this table:
90 and over}
A
80-below 90
B
70-below 80
C
(passing)
below 70
D
(not passing)
In computing the average, the final exam has twice as much weight as
any of the other three exams. The printed report is meant for the
individual student, not you or the office, so it should be intelligible to
him, and it should be personalized.
The Program
0010
PRINT 'HAVE ALL STUDENTS BEEN PROCESSED? ENTER YES
OR
NO'
0020
INPUT
tl·:t>
0030
IF
f'i~I;::::'YES'
GOlD
310
o
0
' + ()
P R I NT' EN l E H N
(~M
E
0
F S T
1...1
It E
NT'
OO:jO
INPUT
N~;
0060
PRINT 'ENTER GRADES FOR EXAMS'
0070
INPUT
El,E2,E3,F
o oao
(~::::
(El
+E~?+E3+21('F)
/!:.:.;
0090
IF
A<70
GOTO
180
0100
IF
A<80
GOTD
160
0110
IF
A<90
GOlD 140
() :1.20 G':I;::::' A '
0:1.30 GOTD
1?O
o
:1.
1
+0
G'~;::::'
B'
O:l.~50
GOTD
:I.?O
o
:1.60
G~;::::'
C '
O:/."?O
GOlD
190
o
:1.80
G~I;::::':O'
0190
PF~INT
FI ...
r
J
FINt,L
GI~{i[lES
FOt~
:'
INS
O;?OO
PRINT FLP,' YOUR
GH(~DE
FDF~
THE
FII~ST
EXAM
l,J(~S:
' . .
El
02:1.0
PRINT FLP, 'YOUR GRADE FOR THE SECOND EXAM WAS: . ,E2
02~.~O
PRINT
FI .. ,P
J
YDUI;{
GI~(~:OE
FDI~
THE
THI
F~:O
EX(.:lt'l
I"'A~:):
',E3
0~?30
PI~INT
FI...P
J
YOUR
GI~fiDE
FDI~
THE
FIN(~L..
I",IP,E:
' I
F
0240
PRINT
USING 250,FLP,A,G$
0250
:YOUR FINAL AVERAGE IS
"""I""
AND YOUR FINAL.. GRADE IS "
0260
IF
G$='D'
GOTO
290
0270
PRINT FLP, 'CONGRATULATIONS ON PASSING THIS COURSE! .
02BO
GOTD 300
0290
PRINT FLP, 'YOU DID NOT
PASS,
MAKE AN APPOINTMENT TO
SEE ME'
0300 GOlD :1.0
0310
~:)TOP
Exercises
139
C " . ' " . "
"
C
'~"'"
/
c
c
Exercise for Chapter 8. Setting Up Your Own Format-PRINT USING
and Image Statements
You are a teacher and you want to write a program that will figure out
and print a report of grades for each student at the end of the term.
There have been three exams during the term, and a final exam. The
grade for the term will be a letter grade based on an average of the
exam scores according to this table:
90 and over}
A
80-below 90
B
70-below 80
C
(passing)
below 70
D
(not passing)
In computing the average, the final exam has twice as much weight as
any of the other three exams. The printed report is meant for the
individual student, not you or the office, so it should be intelligible to
him, and it should be personalized.
The Program
0010
PRINT 'HAVE ALL STUDENTS BEEN PROCESSED? ENTER YES
OR
NO'
0020
INPUT
tl·:t>
0030
IF
f'i~I;::::'YES'
GOlD
310
o
0
' + ()
P R I NT' EN l E H N
(~M
E
0
F S T
1...1
It E
NT'
OO:jO
INPUT
N~;
0060
PRINT 'ENTER GRADES FOR EXAMS'
0070
INPUT
El,E2,E3,F
o oao
(~::::
(El
+E~?+E3+21('F)
/!:.:.;
0090
IF
A<70
GOTO
180
0100
IF
A<80
GOTD
160
0110
IF
A<90
GOlD 140
() :1.20 G':I;::::' A '
0:1.30 GOTD
1?O
o
:1.
1
+0
G'~;::::'
B'
O:l.~50
GOTD
:I.?O
o
:1.60
G~;::::'
C '
O:/."?O
GOlD
190
o
:1.80
G~I;::::':O'
0190
PF~INT
FI ...
r
J
FINt,L
GI~{i[lES
FOt~
:'
INS
O;?OO
PRINT FLP,' YOUR
GH(~DE
FDF~
THE
FII~ST
EXAM
l,J(~S:
' . .
El
02:1.0
PRINT FLP, 'YOUR GRADE FOR THE SECOND EXAM WAS: . ,E2
02~.~O
PRINT
FI .. ,P
J
YDUI;{
GI~(~:OE
FDI~
THE
THI
F~:O
EX(.:lt'l
I"'A~:):
',E3
0~?30
PI~INT
FI...P
J
YOUR
GI~fiDE
FDI~
THE
FIN(~L..
I",IP,E:
' I
F
0240
PRINT
USING 250,FLP,A,G$
0250
:YOUR FINAL AVERAGE IS
"""I""
AND YOUR FINAL.. GRADE IS "
0260
IF
G$='D'
GOTO
290
0270
PRINT FLP, 'CONGRATULATIONS ON PASSING THIS COURSE! .
02BO
GOTD 300
0290
PRINT FLP, 'YOU DID NOT
PASS,
MAKE AN APPOINTMENT TO
SEE ME'
0300 GOlD :1.0
0310
~:)TOP
Exercises
139

Advertisement

Table of Contents
loading

Table of Contents