home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Falcon 030 Power 2
/
F030_POWER2.iso
/
ST_STE
/
MAGS
/
ICTARI03.ARJ
/
ictari.03
/
GFA
/
TUTORIAL
/
EXAMMARK.GFA
(
.txt
)
< prev
next >
Wrap
GFA-BASIC Atari
|
1989-07-29
|
4KB
|
180 lines
' ** **
' ** Simple Exam Grade Program To Summarise Tutorial Month One **
' ** (Should Be Run In Low Res) **
' ** **
' ** First Run it and see what it does, **
' ** Then look at the source and see how it does it, **
' ** And then experiment with and expand for now month. **
' ** **
'
' **** Create Table And Program Parameter ****
DIM grade&(5) ! Grade Summary: A-F Are (1)-(5) Resp.
' ! I.e. (0) Is Not Used
stop&=9999 ! Enter This To Stop Input And Goto Output
'
'
' **** INPUT: Clear Screen And Display Intro Screen ****
CLS
credits
'
' **** Clear Screen And Process A Candidate ****
CLS
process_student
'
' **** Continue Processing Candidates Until Enter stop& ****
WHILE cand_no&<>stop&
process_student
WEND
'
'
' **** OUTPUT: First Check If There Are #Any# Candidates ****
count&=6
REPEAT
SUB count&,1
UNTIL grade&(count&)>0 OR count&=0 ! This Is Why (0) Is Not Used
'
' **** If Candidates Then Clear Screen And Display Summary Table ****
IF count&>0
CLS
display_results
ELSE
PRINT CHR$(10);"NO CANDIDATES ENTERED!"
ENDIF
'
' **** Finish ****
PRINT CHR$(7);CHR$(10);"TERMINATED."
EDIT
'
'
'
'
'
'
PROCEDURE credits
LOCAL line&
'
FOR line&=1 TO 23
PRINT
NEXT line&
PRINT "---------------------------------------"
PRINT " EXAM GRADE DEMO PROGRAM"
PRINT " Written In GFA, By PROFESSOR,"
PRINT " For Ictari User Group Magazine."
PRINT " (Should Be Run In Low Resolution)"
PRINT CHR$(10);" Source Code: Freeware"
PRINT " Executable Code: Professor, (c) 1993"
PRINT "---------------------------------------"
PRINT " Press any key to continue:"
PRINT "---------------------------------------"
FOR line&=1 TO 10
PRINT " "
NEXT line&
~INP(2)
RETURN
'
'
'
'
PROCEDURE process_student
process_cand_no
'
' **** Don`t Process Grade If Entered stop& ****
IF cand_no&<>stop&
process_grade
ENDIF
RETURN
'
'
'
'
PROCEDURE process_cand_no
PRINT CHR$(10);"Enter candidate number (1000-5000),"
PRINT " or enter ";stop&;" to stop."
INPUT "Candidate: ",cand_no&
'
WHILE (cand_no&<1000 OR cand_no&>5000) AND cand_no&<>stop&
PRINT CHR$(7);"INVALID, RANGE 1000-5000 OR ";stop&;" ONLY."
INPUT "Candidate: ",cand_no&
WEND
RETURN
'
'
'
'
PROCEDURE process_grade
LOCAL grade&
'
PRINT CHR$(10);"Enter grade (0-100)."
INPUT "Grade: ",grade&
WHILE grade&<0 OR grade&>100
PRINT CHR$(7);"INVALID, RANGE 0-100 ONLY."
INPUT "Number: ",grade&
WEND
'
' **** Add Valid Grade To Summary Table ****
PRINT CHR$(10);"Candidate achieved grade ";
IF grade&>79 ! Grade A: 100-80
PRINT "A."
ADD grade&(1),1
ELSE IF grade&>69 ! Grade B: 79-70
PRINT "B."
ADD grade&(2),1
ELSE IF grade&>49 ! Grade C: 69-50
PRINT "C."
ADD grade&(3),1
ELSE IF grade&>39 ! Grade D: 49-40
PRINT "D."
ADD grade&(4),1
ELSE ! Grade F: 39-0
PRINT "F."
ADD grade&(5),1
ENDIF
PRINT
RETURN
'
'
'
'
PROCEDURE display_results
LOCAL count&,sum&,pass& ! Several LOCAL Variables Here
'
' **** Calculate 'Total Sum': A+B+C+D+F ****
FOR count&=1 TO 5
ADD sum&,grade&(count&)
NEXT count&
'
PRINT CHR$(10);"Out of ";sum&;" candidate(s) total:"
PRINT
PRINT " ";grade&(1);" achieved grade A,"
PRINT " ";grade&(2);" achieved grade B,"
PRINT " ";grade&(3);" achieved grade C,"
PRINT " ";grade&(4);" achieved grade D,"
PRINT " & ";grade&(5);" achieved grade F."
'
' **** Calculate 'Passed Sum': A+B+C ****
FOR count&=1 TO 3
ADD pass&,grade&(count&)
NEXT count&
'
' **** Convert To Percentage Out Of 'Total Sum' ****
pass&=(pass&/sum&)*100
'
PRINT CHR$(10);
'
' **** Tabulation: Need Space(s) If Only Two(/One) Digits ****
gap(pass&<100)
gap(pass&<10)
PRINT ;pass&;"% passed (with A,B or C)."
PRINT CHR$(10);"Press any key to finish:"
~INP(2)
RETURN
'
'
'
'
PROCEDURE gap(gap&)
IF gap&=TRUE
PRINT " ";
ENDIF
RETURN