REM This program reads in records from a file containing bowling REM scores for some number of people. The last record in the file REM has a score of 999 and is meant to mark the eof. REM The program writes a new file containing the names of bowlers REM whose score is above the average. REM PROGRAM ABOVE AVERAGE BOWLERS INTEGER SCORE CHARACTER NAME*12 INTEGER COUNT INTEGER SUM INTEGER AVERAGE INTEGER FLAG BEGIN REM REM Initialize the record counter, sum and eof flag REM LET FLAG = 999 LET COUNT = 0 LET SUM = 0 REM REM Loop to read in scores and get the sum of scores REM OPEN FOR INPUT AS FILE 21 WITH RECORDSIZE 16 L10: READ 21, NAME, SCORE IF SCORE EQL FLAG THEN L30 LET COUNT = COUNT + 1 LET SUM = SUM + SCORE GO TO L10 L30: CLOSE 21 REM Compute the average bowling score LET AVERAGE = SUM / COUNT REM REM Loop to read in the names and scores and write the name to REM another file if the score for that name is above the average. REM OPEN FOR INPUT AS FILE 21 WITH RECORDSIZE 16 OPEN FOR OUTPUT AS FILE 22 WITH RECORDSIZE 12 L40: READ 21, NAME, SCORE IF SCORE EQL FLAG THEN L90 IF SCORE LSS AVERAGE THEN L40 WRITE 22, NAME GO TO L40 L90: CLOSE 22 CLOSE 21 END