Indiana University of Pennsylvania
Computer Science Department
CO 110   Spring 1984
McKelvey and Wolfe

                    Programming Project #3

    For your third programming project, you are to write a program to help with the judging of an ice skating competition.   This project is designed to give you a chance to gain some experience with the interactive capabilities of CP-6 and to let you use some of the FORTRAN features you have recently learned:   counter loops, parameters, character variables, etc.

    Your program must read in a set of data for each contestant, determine the total score for that contestant, compare that score with other contestant's scores, and print out the winner and the winning score.  The set of data for each contestant consists of six lines of input, as illustrated by the following example.

    'SEBASTIAN CABOT', 5.733
    5.7
    5.8
    5.6
    5.8
    5.9

The first data line consists of the contestant's name and average score from the first round of competition.  The other five lines are the judges scores from the second round of competition.  Your program must find the second-round average and add it to the first-round average to get the contestant's total score. To get the second-round average, eliminate the low and high scores and calculate the average of the remaining scores.  The program should print out the contestant's name, second-round average score, and the total score in the following form.

SEBASTIAN CABOT     SECOND AVERAGE = 5.766666  TOTAL = 11.49967

    The number of scores (five) is the same for all contestant's. Your program should keep this number as a parameter and use it that way, so that if there were more judges only the parameter would need to be changed.

    Your program should repeatedly read in contestants' sets of data and print out the score report line.  When the program encounters a name that is blank, e.g. '     ', the program should consider it a sentinel and should print out the winner of the competition (the person with the highest total score) and the winning total score, for example

THE WINNER IS SEBASTIAN CABOT        THE TOTAL IS 11.49967


    Because you will be running this program at a terminal, you must print a prompt message prior to each input line to show what sort of input is expected.  The prompt message for the first data line of a data set must be:

    CONTESTANT NAME AND FIRST ROUND AVERAGE:

The prompt message for each of the scores should be of the form

    SCORE n

where n is a number from 1 to 5 depending on which of the five scores is being entered.

    Your program must check the score values as they are entered to make sure they are valid.  A score is not valid if it is less than 1.0 or greater than 6.0.  When an invalid score is entered, the program must display an error message, such as

    INVALID SCORE!!

Then, the program must redisplay the same prompt and accept a replacement score.  Your program need not check the validity of the first-round average, although it is not a bad idea to do that.

    To illustrate how your program works, you must run it with at least three sets of data.  Three suggested sets are listed below.  While entering this data during the program run, you must make at least two mistakes on scores to show that your program catches the invalid scores.  You may use your own data for testing; however, you must use the suggested data for the run of the program that you hand in.

    'SEBASTIAN CABOT', 5.733
    5.7
    5.8
    5.6
    5.8
    5.9
    'ANDY DEVINE', 5.6925
    5.7
    5.9
    6.0
    5.7
    6.0
    'VIC TAYBACK', 5.5515
    5.5
    5.7
    5.7
    5.6
    5.4
    '     ', 0


                         IMPORTANT NOTES

1.  The sentinel data line must include a first-round average,
   even though it is not used by the program.

2.  The contestant's name is no longer than 20 characters.

3.  You must use a DO-loop to read the scores for a contestant.

4.  You must hand in a flow diagram with your program listing.
   The flow diagram should be on 8 1/2 x 11 paper and should be
   a detailed representation of the program.  Use connectors to
   indicate how the different pages fit together, if the flow
   diagram does not fit on one sheet.

5.  You must hand in a single unbroken piece of paper showing
   your program listing and the running of the program.

6.  The date and time must appear on the program listing.  One
   way to make sure this happens is to give the !DISPLAY command
   after running the program.

7.  The program listing must include (at a minimum) the following
   comments:  Program title, Your name and Section #, Program
   description, and the Data Table (variables and parameters).
   Suggested other comments - to identify the significant tasks
   within the program.

8.  You may use only the kinds of data and control structures
   described in the lectures.  That is, there should be limited
   use of GO TO statements and no use of arrays.

9.  Don't forget to write your name, recitation section number,
   the project number, and the date on the outside of the
   listing.