CS 2310

Project #4: Using dynamic linked list to write a simple student records report program with sorting function

This project is an elaboration of Project 2 (not 3). However, it requires using dynamic linked list to implement the list of student records and print out student records in lexicograpgic order of last names.

Use Visual C++ to write your program.

As records secretary for Cougar High School, you have been asked by the principal to prepare a report on the grades of some of the school's top athletes. Specifically, you must print each of the athlete's average letter grades based on their scores from three academic courses. Input will be taken from the file stufile.txt, which is organized as follows: Each athlete in the file has four lines of information recorded - name (at most 20 characters including the comma and white space), student ID (SS#), class rank (1=Freshman, 2=Sophomore, 3=Junior, 4=Senior), and the three scores. Information for at most 15 athletes is stored in the file, but the first line of the file contains an integer showing the exact number of athletes.

Use struct class type as data representation of a student record, as described in Project 2. However, this time, add a link field into the struct which points to the next student record. Look at the sample specification file proj4_prototype.h for the suggested data type declarations.

Then, define a class to hold a head pointer which points to the first student records. A student record is stored in a node dynamically allocated in free store memory using new operator. Student records must be sorted by student last names in lexicographic order. If two students have the same last name, use their first name to do the sorting. Implement member functions necessary to do the sorting and specified reporting as described in the following. Again, Look at the sample specification file proj4_prototype.h for the suggested data type declarations.

You can assume that all scores are integers from 0 to 100. Output of the program should be printed on the screen. Athletes’ names ID numbers, class, ranks, and, letter grades are to be printed twice, the first time in alphabetical order by last name, with "A" students first, "B" students second, and so forth. In cases when the last names of more than one students are the same, sort the student records with the same last name in alphabetical order by first name. The second time they are to be printed in alphabetical order by last name, with freshman students first, sophomore students second, and so forth. Note that the students’ names are printed out in the format of "Lastname, Firstname", e.g., "Zitt, Kevin"; the column of student ID numbers should be aligned three spaces beyond the maximum name length, the column of class ranks should be aligned three spaces beyond the column of student IDs, and the column of grades should be aligned three spaces beyond the column of class ranks.

A sample implementation file of the class member functions and a main function is written in file proj4_prototype.cpp. In the main function, there is an outline of the suggested steps to do the reporting job.

Use input file stufile.txt to test your program.

On the due date (check the schedule), turn in a print-out of the program source code and a diskette containing the header (.h) file, source code (.cpp file), and the I/O files.

stuflie.txt sample

10

Kevin Zitt

399-86-4533

1

65 78 66

Perry Placrue

455-78-9055

2

78 44 69

Alicia Placrue

678-89-4567

3

85 90 77

Pyretha Noosbaum,

456-78-9045

4

98 90 91

Hypatia Noosbaum,

456- 65-8023

1

99 95 92

Otto Mattick

218-45-8923

2

87 78 90

Alexander Grack

317-56-4555

3

67 87 56

S.T. Royd

435-69-0675

4

45 67 50

Derland Walpole

566-90-4563

1

78 89 65

Jellona Crimp

234-78-6745

2

38 56 89

 

sample output

NAME              STUDENT ID  RANK      GRADE

Noosbaum, Hypatia 456-65-8023 Freshman  A

Noosbaum, Pyretha 456-78-9045 Senior    A

Aardvark, Alicia  678-89-4567 Junior    B

Mattick, Otto     218-45-8923 Sophomore B

Grack, Alexander  317-56-4555 Junior    C

Walpole, Derland  566-90-4563 Freshman  C

Crimp, Jellona    234-78-6745 Sophomore D

Plaque, Perry     455-78-9055 Sophomore D

Zitt, Kevin       399-86-4533 Freshman  D

Royd, S.T.        435-89-0675 Senior    F

 

NAME              STUDENT ID  RANK      GRADE

Noosbaum, Hypatia 456-65-8023 Freshman  A

Walpole, Derland  566-90-4563 Freshman  C

Zitt, Kevin       399-86-4533 Freshman  D

Crimp, Jellona    234-78-6745 Sophomore D

Mattick, Otto     218-45-8923 Sophomore B

Plaque, Perry     455-78-9055 Sophomore D

Aardvark, Alicia  678-89-4567 Junior    B

Grack, Alexander  317-56-4555 Junior    C

Noosba, Pyretha   456-78-9045 Senior    A

Royd, S.T.        435-89-0675 Senior    F