Write a program that creates a file containing a table showing the student ID numbers and averages of
all the students in a course in ascending order by ID number. The input to the program is a file
containing student records. Each student record consists of a student’s first name, a student’s last name,
a student’s ID number, and the student’s average. Each of the fields of the record is separated by a
newline character and there is one newline character separating one student’s record from the next
record in the file. Each student’s ID number has the following form LDD-DDDDD. L is the letter B,
M, or P and the D’s are digits. You may assume that the data was validated before it was put in the file.
You may assume that there will not be more than one hundred student records in the input file.
Your program must allow the user to enter the names of both the input file and the output file.
Create a system of parallel arrays to store the data needed from the file. One array should store the
student’s ID numbers and one array should store the student’s averages. The arrays should be related by
the subscripts. The first student’s ID number is in the student ID array at subscript 0 and the student’s
average is the averages array at subscript 0.
Your program must consist of at least four meaningful methods. For example, you might create a
method to read the input file and store the necessary data in your arrays, another method that performs
the sort, and another method that writes the data from the arrays to the output file (your fourth method
would be your main method). Create additional methods as you find necessary. You must pass data
between the methods using arguments and parameters. You may not declare any variables globally
(outside of the methods). There must be a paragraph of comments before each of your methods that
describes what the method does and what inputs it receives and outputs it returns.
Modify the selection sort algorithm provided in the text to perform the sort. When you sort the data in
your arrays you must maintain the relationship between the elements across the parallel arrays. As you
move an ID number, the corresponding average must also be moved.