CS 2310

Project #1: Using class data type to write a simple student records report program

This project is to learn how to use C++ class data type to store records, how to read record data from a file, do some statistics, and print out record data and statistical data in specified format.

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 class data type as data representation of a student record. Then, design member functions to do the statistics, reporting, etc. Look at the sample specification file proj1_prototype.h for the suggested data type declarations. For each student, your program should calculate the average of the 3 scores and determine the letter grade based on the average (A - 90 or above, B - between 80 and 90, C - between 70 and 80, D - between 60 and 70, and F - below 60). also, your program must find the students with the highest and the lowest averages.

Your program must read in student information from "stufile.txt". You can create the file and copy the examples in the following and save them in the file. Or, you can create your own file using the format specified above.

You can assume that all scores are integers from 0 to 100. Output from this program should be printed out on the screen. The output of the program should include the echo-print of all the records that are read from the input file and the statistical data specified as follows. When printing each student record, the column of student ID numbers should be aligned at least one space beyond the maximum name length, the column of class ranks should be aligned at least one space beyond the column of student IDs, and the column of grades should be aligned at least one space beyond the column of class ranks. Echo-printing of the students records must begin with a heading (see the example in the following). Students ranks must be printed as "Freshman", "Sophomore", "Junior", or "Senior", instead of a number. In the end of the output, the name of the students with the highest average and the lowest average must be printed with proper labeling (see the example output at the bottom of this page).

On the project due date (check the course schedule), turn in a print-out of your source code and a diskette containing the header (.h) file, source code (.cpp file), and the input files.

stufile.txt sample

10

Kevin Zitt

399-86-4533

1

65 78 66

Perry Placrue

455-78-9055

2

78 44 69

Alicia Aardvark

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

 

Kevin Zitt       399-86-4533 Freshman  D

Perry Plaque     455-78-9055 Sophomore D

Alicia Aardvark  678-89-4567 Junior    B

Pyretha Noosbaum 456-78-9045 Senior    A

Hypatia Noosbaum 456-65-8023 Freshman  A

Otto Mattick     218-45-8923 Sophomore B

Alexander Grack  317-56-4555 Junior    C

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

Derland Walpole  566-90-4563 Freshman  C

Jellona Crimp    234-78-6745 Sophomore D

 

The student whose average is the highest is: Hypatia Noosbaum

The student whose average is the lowest is: S.T. Royd