EXAM MARKS (1K ZX81)
by G A Genever, Sevenoaks, Kent
from Your Computer (October 1981), pages 65-67

Exam marks are a headache for teachers at the end of term. Here is how I
used the ZX-81 to work out percentage and form positions for seven classes
of about 30 pupils. It all started when my daughter Rachel told me, in the
way children do, that she had volunteered me to help with the English marks
because I had just acquired a ZX-81.

Each pupil had three marks; one for language, one for comprehension and one
for essay. Each mark had to be calculated as a percentage of the maximum
mark, and an overall percentage produced, for each pupil. Finally, an
average percentage overall had to be calculated.

Ideally, I would have put all the processing into one program to avoid
having to input the percentages again but this was not possible with 1K 
of course, I have a 16K RAM on order. However, the programs were subjected
to a thorough workout one Sunday afternoon when I processed the whole set
of seven classes.

The marks were on seven sheets and as I put them through the final program
of the suite "PC MKS", I copied the percentages back to the sheets. "PC
MKS" is very abbreviated, and the letter N, L, C and E mean number of
pupils in class, maximum language mark, maximum composition mark and
maximum essay mark.

Running totals are kept and finally the overall average is calculated.
Naturally, your application may have a slightly different format but this
program should give a useful structure. I avoided holding the marks in
memory, or on the screen, so that any size of class can be input.

To put the marks into order for the form, highest first, I used a bubble
sort, which will handle 40 marks easily. I found that an identification
number was very helpful when dealing with large classes. So, the sort takes
as input for each pupil, the overall percentage and a sequential
identification number which I pencilled directly on to the data sheets in
the format of a decimal number. For example, 78.01 (Newline), 72.02
(Newline). The sort adds .001 to each identification number so as not to
lose the trailing zeros.

When I first ran the program with an input of 40 items it took 1.5 minutes
to sort, and I thought that the ZX-81 had forgotten what it was doing. It
had not  it was keeping the display going as well. So I added line 82
Fast, and then it took 15 seconds.

Do not be surprised that the screen goes blank  the ZX-81 is thinking
furiously. The use of integer in line 95 means that the identification
number is ignored for sorting purposes. If you run out of display file
before all the records are printed, press CONT and NEWLINE. To look at a
record again after CONT, use command PRINT A(N) where N is the final
sequence of the item.
