Posted on

# 21 Problem Statement Recently at a University there has been a huge increase in the number of

2.1 Problem Statement

Recently at a University, there has been a huge increase in the number of enrollments. All records of students are entered into a flat file by the registrar when the students register and updated accordingly if there is a need. As a result of the increase in enrollments, this file now has a lot of records. Hence, the statistical officers are now finding it hard to analyze this file to produce various reports for the management.

You are required to write a program which will read in this file and produce various reports as outlined.

Input File:
The input file called StudentRec.txt contains a list of student records. Each record is on a single line and the fields are separated by spaces. The names of the fields are:
– Lastname – string
– Firstname (initial) – char
– ID# – integer
– Year of birth – integer
– GPA – double

An example record may have the following form:
Doe J 2021123419903.2

And the format of the actual file is shown below. (Note: the file doesn’t show all records and for clarity, fields here are shown separated by tabs, but in the actual file they are separated by spaces).
Assume that the file can have a maximum of 300 records.
– The first three lines are just header lines and can be discarded
– Student id contains an 8-digit number.
– Year of birth contains a 4-digit number
– GPA is a one decimal place number between 0 – 4

Program Requirements:
1. You must read this file from the current directory and store the records of students into appropriate arrays.
2. Your program should then be able to process the following commands. i.e. the program should provide the user with the following menu.
– 1. Print the entire list as per the read file.
– 2. Print the entire list with the inclusion of last name initial and age.
– 3. Print the list sorted by GPA.
– 4. Print the list of students which match a given lastname initial.
– 5. Calculate and display the corresponding degree classification (according to GPA) as provided in Table A.
– 6. Produce a file called Enrollments.txt (in the current directory), with all the details [Last name, Lastname Initial, Firstname Initial, ID#, Age, GPA, and degree classification].
– 7. Exit the program.

1. Print the entire class list. This menu item is selected by typing 1, and it should simply print the contents of the file in a suitable format on the screen. (Fields (columns) to display in output are: Last name, Firstname Initial, ID#, Age, GPA, and degree classification)
2. Print the entire class list with the inclusion of last name initial and age. This menu item is selected by typing 2, and it should simply print the contents of the file in a suitable format on the screen with the inclusion of last name initial and age. (Fields (columns) to display in the output are: Last name, Lastname Initial, Firstname Initial, ID#, Age, and GPA)
3. Print the class list sorted by GPA. This menu item is selected by typing 3. The program then prints the list in ascending order of GPA. (Fields (columns) to display in the output are: Lastname Initial, ID#, and GPA)
4. Print the class list of students which match a given lastname initial. The user selects this option by typing 4. Then the user is asked to enter the search initial. If there are students who have that initial, the program prints their record. Otherwise, if no students have last names matching the search initial, a “no matching record found” message is displayed. (Fields (columns) to display in the output are: lastname and id)
5. Calculate and display the corresponding degree classification as per GPA as provided in Table A. The user selects this option by typing 5. The program then calculates and displays the degree classification according to GPA. The format of the resultant display is shown below:

[The table (Table A) for degree classification as per GPA is given at the end of this project description]

6. Produce a file called Enrollments.txt (in the current directory), with all the details [Last name, Lastname Initial, Firstname Initial, ID#, Age, GPA, and degree classification]. The user selects this option by typing 6. The program then generates a file “Enrollments.txt” in the current directory with the following details [Last name, Lastname Initial, Firstname Initial, ID#, Age, GPA, and degree classification].
7. Exit the program. User selects this option by typing 7. This is when the program should end.

Note: After each command is processed (except menu 7), the program must display the menu options again.

Function to sort an array:
There are many algorithms to sort an array according to an ascending or descending criterion. However, we will use the following as it is easiest to understand and CODE.

Minimum Element Sort:
Go through the array and find the smallest element. Swap it with the first element of the array. Now find the smallest element of the rest of the array and swap it with the second element of the array. And so on. Rather more formally: to sort (x0, …, xn) into ascending order for i=0 to n-1 begin find the smallest of (xi, …, xn)

Solved By Verified
Study Co-Pilot

Instant