Indiana University of Pennsylvania
Computer Science Department
CO 110 Main Session 84
Programming Assignment #4
For this project, you are to write a program to perform
several tasks on the examination scores of a group of students.
Many of these tasks are required to be done by the use of one or
more subprograms.
The data for this program are contained in a disk file which
you can read by placing the following statement near the
beginning of your program.
OPEN (105, FILE='110SCORES.COMPSCI', USAGE='INPUT,SHARED')
The first record in this file contains the number of student
records in the file. Other records contain three items of
information about one student: name, social security number, and
examination score. Following is an example.
'Arthur' 103562011 76
Begin your program by reading into arrays all the student
information. There are no more than 50 students in all. Then,
sort the information so that the students are in alphabetical
order. Be sure to keep the arrays parallel as you sort. Once
the sort is finished, your program is required to produce three
reports, as follows.
1. An alphabetical list showing the name, social security number
and exam score. At the end of the list, the program must print a
line that shows the median (middle score when scores are ranked)
and the mode (most frequently occurring score) for the exam.
Note: the calculation of the median is described in the book.
The form of this report is shown below.
CLASS LIST
NAME SOCIAL SECURITY SCORE
nnnnnnnnnnnnnnnn ddddddddd ddd
. . .
. . .
THE MEDIAN IS dd.d THE MODE IS dd
2. A posting list in descending order on social security number,
showing only the social security number and the exam score. You
must use a pointer array to create this list; you may not reorder
the arrays. The form of this report is shown on the next page.
POSTING LIST
SOCIAL SECURITY SCORE
ddddddddd ddd
. .
. .
3. A ranking list in descending order on score, showing the name
and exam score. You must use a pointer array to create this
listing; you may not reorder the arrays. After the listing, the
program must print a grade distribution showing the number of
students getting As (score 90 or better), Bs (80 to 89), Cs (70-
79), Ds (60-69), and Fs (less than 60). The form of this report
is shown below.
RANKING LIST
NAME SCORE
nnnnnnnnnnnnnnn ddd
. .
. .
GRADE DISTRIBUTION
NUMBER GRADE
dd g
. .
. .
In these report forms, "n" is a letter in a name, "d" is a digit
in a number, and "g" is a letter grade. Each report must be on a
separate output page. The titles used in the report forms are
the ones you must use in your program; spacing may vary.
In writing this program, you are required to use subprograms
to perform specific tasks and to use them in specific ways. A
list of the requirements follows.
1. You must write a subroutine to do a pointer sort of an array
of numbers. This subroutine must be used to create the pointer
array for the posting list AND to create the pointer array for
the ranking list. You may find additional uses for it.
2. You must write a function to calculate the median exam score.
3. You must write a subroutine to determine the grade
distribution.
4. You must write either a function or a subroutine to calculate
the mode of the exam.
5. You may write a subroutine to do the initial alphabetical
sort, although you may also do this sort in the main program.
You are required to hand in a flowchart for this program.
You should flowchart each subprogram and the main program
separately. Other flowchart requirements are as in program #2.