Question: Through this assignment, you are going to be maintaining a file of all students and their registered courses to learn the concepts of structures, pointers
Through this assignment, you are going to be maintaining a file of all students and their registered courses to learn the concepts of structures, pointers to structures, dynamic memory allocation and file manipulation. For this, a structure called studentInfo with the following member elements should be defined:
Student ID - 8 char long
First Name - 20 char long
Last Name - 25 char long
Number of Courses Attending - integer
Array of courseInfo - a 10 element array of courseInfo elements
next - Pointer to the next student structure in the list
where the courseInfo structure has been defined as follow:
struct courseInfo{
int courseID;
char courseName[30];
};
Write a complete, well documented C program that will be able to:
a. Add a new student
b. Delete a student and all information related to that student
c. Search for a student and their information
d. Display a list of current students
e. Save student information to file
f. Load student information from file
Assignment Description:
You are provided with a data file called studentRecords.txt that has the data for a number of students. You are required to read this data from the input file into a sorted linked list data structure. The linked list must be sorted based on the Student ID.The sample input file will end with a line that has three stars. An example of an input file with two fictional students is:
| studentList.txt |
| 23456770, Mina, Porter,3,ENEE,114 ,CMSC,412,ENME,515 23456790, Alex,Simpson,1,CMSC,412 *** |
For each student, the data file is formatted in the following manner:
After loading the student list from the list, your program should be able to interactively ask the user for input. Your interactive menu should have the following inputs:
1. Add new student
2. Delete a student
3. Search for a student
4. Display current students
5. Save student information to file
6. Exit
Hints: The following points are to be considered:
a. Student ID should be unique and 8 characters of numbers (such as 12345678, 10344997)
b. First name and Last Name should be started with capital letters (upper case).
c. Student information should be sorted based on the student IDs both in the linked list and in the input/output file.
2- Your program should implement at least the following functions:
a) addStudentInfo() : To add a new student and his/her registered courses.
a. Make sure the first letter of the first and last names is upper case (capital letter).
b. The student ID should be unique; you cannot have two students with the same StudentID. So, before adding a student, search for the studentID to be sure that you have not had it previously entered.
c. If the linked list is empty, the new student is the head of the list. If not, search through the linked list to find the appropriate spot within the sorted linked list.
b) deleteStudentInfo(): To delete a student information using its StudentID.
a. Search the linked list for a student matching the studentID passed in. If it is found, delete it from the linked list.
b. Note that the linked list is sorted based on studentID!
c) searchStudentID(): To search for a student using studentID
a. You do not have to search all the linked list as it is sorted based on studendIDs.
b. This function can be called from addStudent() and deleteStudent() functions.
d) searchStudentlName():To search for a student using his/her last name and display the related information if the student exists.
a. You have to search all the linked list as it is not sorted based on last names
b. Before starting the search, make sure the name supplied by the user has a capital letter for the first letter.
e) displayStudentInfo(): To display the current student information that exists in the linked list
f) saveStudentInfo(): To save student information from the sorted linked list to a file (studentRecords.txt)
g) loadStudentinfo(): To read all the student information from an input file (studentRecords.txt)
a. This function should be called at the beginning of you program to load all previous student information saved in the input file
b. Student information should be formatted and stored in a sorted linked list.
h) finish():To save student information in a file(studentRecords.txt) and exit from the program
Sample Run
A sample run of the program, with its interactive menu is shown below.
1. Add new student
2. Delete a student
3. Search for a student
4. Display current students
5. Save student information to file
6. Exit
>1
Adding new student:
Student ID : 23456780
First name : john
Last name : rezaei
Number of courses: 2
Course ID: 412
Course Name: CMSC
Course ID: 123
Course Name: MATH
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
