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 >
GFA-BASIC Atari  |  1989-07-29  |  4KB  |  180 lines

  1. '      **                                                           **
  2. '      ** Simple Exam Grade Program To Summarise Tutorial Month One **
  3. '      **                (Should Be Run In Low Res)                 **
  4. '      **                                                           **
  5. '      **            First Run it and see what it does,             **
  6. '      **      Then look at the source and see how it does it,      **
  7. '      **    And then experiment with and expand for now month.     **
  8. '      **                                                           **
  9. '
  10. ' **** Create Table And Program Parameter ****
  11. DIM grade&(5)                        ! Grade Summary: A-F Are (1)-(5) Resp.
  12. '                                    !         I.e. (0) Is Not Used
  13. stop&=9999                           ! Enter This To Stop Input And Goto Output
  14. '
  15. '
  16. ' **** INPUT: Clear Screen And Display Intro Screen ****
  17. CLS
  18. credits
  19. '
  20. ' **** Clear Screen And Process A Candidate ****
  21. CLS
  22. process_student
  23. '
  24. ' **** Continue Processing Candidates Until Enter stop& ****
  25. WHILE cand_no&<>stop&
  26.   process_student
  27. WEND
  28. '
  29. '
  30. ' **** OUTPUT: First Check If There Are #Any# Candidates ****
  31. count&=6
  32. REPEAT
  33.   SUB count&,1
  34. UNTIL grade&(count&)>0 OR count&=0   ! This Is Why (0) Is Not Used
  35. '
  36. ' **** If Candidates Then Clear Screen And Display Summary Table ****
  37. IF count&>0
  38.   CLS
  39.   display_results
  40. ELSE
  41.   PRINT CHR$(10);"NO CANDIDATES ENTERED!"
  42. ENDIF
  43. '
  44. ' **** Finish ****
  45. PRINT CHR$(7);CHR$(10);"TERMINATED."
  46. EDIT
  47. '
  48. '
  49. '
  50. '
  51. '
  52. '
  53. PROCEDURE credits
  54.   LOCAL line&
  55.   '
  56.   FOR line&=1 TO 23
  57.     PRINT
  58.   NEXT line&
  59.   PRINT "---------------------------------------"
  60.   PRINT "        EXAM GRADE DEMO PROGRAM"
  61.   PRINT "     Written In GFA, By PROFESSOR,"
  62.   PRINT "    For Ictari User Group Magazine."
  63.   PRINT "   (Should Be Run In Low Resolution)"
  64.   PRINT CHR$(10);"         Source Code: Freeware"
  65.   PRINT " Executable Code: Professor, (c) 1993"
  66.   PRINT "---------------------------------------"
  67.   PRINT "      Press any key to continue:"
  68.   PRINT "---------------------------------------"
  69.   FOR line&=1 TO 10
  70.     PRINT "  "
  71.   NEXT line&
  72.   ~INP(2)
  73. RETURN
  74. '
  75. '
  76. '
  77. '
  78. PROCEDURE process_student
  79.   process_cand_no
  80.   '
  81.   ' **** Don`t Process Grade If Entered stop& ****
  82.   IF cand_no&<>stop&
  83.     process_grade
  84.   ENDIF
  85. RETURN
  86. '
  87. '
  88. '
  89. '
  90. PROCEDURE process_cand_no
  91.   PRINT CHR$(10);"Enter candidate number (1000-5000),"
  92.   PRINT " or enter ";stop&;" to stop."
  93.   INPUT "Candidate: ",cand_no&
  94.   '
  95.   WHILE (cand_no&<1000 OR cand_no&>5000) AND cand_no&<>stop&
  96.     PRINT CHR$(7);"INVALID, RANGE 1000-5000 OR ";stop&;" ONLY."
  97.     INPUT "Candidate: ",cand_no&
  98.   WEND
  99. RETURN
  100. '
  101. '
  102. '
  103. '
  104. PROCEDURE process_grade
  105.   LOCAL grade&
  106.   '
  107.   PRINT CHR$(10);"Enter grade (0-100)."
  108.   INPUT "Grade: ",grade&
  109.   WHILE grade&<0 OR grade&>100
  110.     PRINT CHR$(7);"INVALID, RANGE 0-100 ONLY."
  111.     INPUT "Number: ",grade&
  112.   WEND
  113.   '
  114.   ' **** Add Valid Grade To Summary Table ****
  115.   PRINT CHR$(10);"Candidate achieved grade ";
  116.   IF grade&>79                       ! Grade A: 100-80
  117.     PRINT "A."
  118.     ADD grade&(1),1
  119.   ELSE IF grade&>69                  ! Grade B: 79-70
  120.     PRINT "B."
  121.     ADD grade&(2),1
  122.   ELSE IF grade&>49                  ! Grade C: 69-50
  123.     PRINT "C."
  124.     ADD grade&(3),1
  125.   ELSE IF grade&>39                  ! Grade D: 49-40
  126.     PRINT "D."
  127.     ADD grade&(4),1
  128.   ELSE                               ! Grade F: 39-0
  129.     PRINT "F."
  130.     ADD grade&(5),1
  131.   ENDIF
  132.   PRINT
  133. RETURN
  134. '
  135. '
  136. '
  137. '
  138. PROCEDURE display_results
  139.   LOCAL count&,sum&,pass&            ! Several LOCAL Variables Here
  140.   '
  141.   ' **** Calculate 'Total Sum': A+B+C+D+F ****
  142.   FOR count&=1 TO 5
  143.     ADD sum&,grade&(count&)
  144.   NEXT count&
  145.   '
  146.   PRINT CHR$(10);"Out of ";sum&;" candidate(s) total:"
  147.   PRINT
  148.   PRINT "   ";grade&(1);" achieved grade A,"
  149.   PRINT "   ";grade&(2);" achieved grade B,"
  150.   PRINT "   ";grade&(3);" achieved grade C,"
  151.   PRINT "   ";grade&(4);" achieved grade D,"
  152.   PRINT " & ";grade&(5);" achieved grade F."
  153.   '
  154.   ' **** Calculate 'Passed Sum': A+B+C ****
  155.   FOR count&=1 TO 3
  156.     ADD pass&,grade&(count&)
  157.   NEXT count&
  158.   '
  159.   ' **** Convert To Percentage Out Of 'Total Sum' ****
  160.   pass&=(pass&/sum&)*100
  161.   '
  162.   PRINT CHR$(10);
  163.   '
  164.   ' **** Tabulation: Need Space(s) If Only Two(/One) Digits ****
  165.   gap(pass&<100)
  166.   gap(pass&<10)
  167.   PRINT ;pass&;"% passed (with A,B or C)."
  168.   PRINT CHR$(10);"Press any key to finish:"
  169.   ~INP(2)
  170. RETURN
  171. '
  172. '
  173. '
  174. '
  175. PROCEDURE gap(gap&)
  176.   IF gap&=TRUE
  177.     PRINT " ";
  178.   ENDIF
  179. RETURN
  180.