Question: Program Summar y Write a C++ object-oriented program to manage a file system for students at Norfolk State University: First Name string Last Name string

Program Summary

Write a C++ object-oriented program to manage a file system for students at Norfolk State University:

First Name string

Last Name string

Student ID unsigned integer

Email string

GPA - float

The program will manipulate the student list based on students from the file students.dat

Class requirements

Create a student class or struct based on the student structure

Create a students class which contains three private members an array of students, the size of the array, and a function to print the contents of a process. The processes class will also provide the following functionality.

Load data from a data file into a student list

Retrieve and print a student from the student list

Insert a student into the student list

Delete a student from the student list

Print the contents of a student record

Print the contents for a list of students

Sort the student list by last Name

Sort the student list by GPA

Processing requirements

Load the students file students.dat

Create a menu to carry out the given operations

Implement input validation to avoid erroneous program errors

Structure of the file

students.dat First Name, Last Name, Student ID, Email, GPA

Smith Jefferey 891789 j.smith@spartans.nsu.edu 3.75 Lee Jackson 3678902 j.lee@spartans.nsu.edu 3.66 Gonzales Mariana, 168790 m.gonzales18@spartans.nsu.edu 4.0 Jones Mike 8973125 m.jones143@spartans.nsu.edu 3.1 Williams Anita 2985465 a.williams@spartans.nsu.edu 3.64 Ronsinson Taylor 3278976 t.robinson@spartans.nsu.edu 3.55 Clark Allen 1094567 a.clark@spartans.nsu.edu 3.48 Turner Tavon 318796 t.turner@spartans.nsu.edu 3.2 Jenkins Nelson 289563 n.jenkins@spartans.nsu.edu 3.0

This is what I have done so far:

#include #include #include #include #include

using namespace std;

struct students { string FirstName,LastName,Email; float GPA; unsigned int StudentID; }; class Students { public:

void studentList(); void insertList(); void deleteStudents(); void getStudents(); void printStudentsList(); void retrieveLastName(); void retieveFirstName(); void retrieveEmail(); void retrieveGPA(); Students(); private: students listAry[30]; int size; void printList() const; }; Students::Students() { size = 0; } void Students::studentList() { ifstream infile; infile.open("students.dat"); size = 0; while (!infile.eof()) { infile >> listAry[size].LastName; infile >> listAry[size].FirstName; infile >> listAry[size].StudentID; infile >> listAry[size].Email; infile >> listAry[size].GPA; size++; } infile.close(); } void Students::printStudentsList() { for (int i = 0; i < size; i++) { cout << "Last Name: " << listAry[i].LastName << " " << "First Name: " << listAry[i].FirstName << " " << "Student ID " << listAry[i].StudentID << " " <<"GPA: " << " " << listAry[i].GPA; cout << endl; } } void Students::getStudents() { int students; cout << endl; cout << "Enter the number of students info in you want r" << endl; cin >> students; cout << endl << "Here is the info you wanted" << endl; { cout << "StudentsName: " << listAry[size].LastName << listAry[size].FirstName << endl; } } void Students::deleteStudents() { int pos; Students::studentList(); cout << endl; cout << "PLease enter the corresponding number of the student's information you wish to delete: " << endl; cin >> pos; cout << endl; for (int i = pos; i < size - 1; i++) { Students[i] = Students[i+1]; } size--; cout << "The student list exluding the deleted student's information: " << endl; printStudentsList(); }

int main() { Students Student; Student.loadList(); int studentId; int process; cout << "1 Retrieve and print a student from the student list "; cout << "2 Insert a student into the student list "; cout << "3 Delete a student from the student list "; cout << "4 Print the contents of a student record "; cout << "5 Print the contents for a list of students "; cout << "6 Sort the student list by last Name "; cout << "7 Sort the student list by GPA"; cin >> process;

switch (process) { case 1: Students.printStudentList(); break; case 2: Students.insertList(); break; case 3: Students.deleteStudents(); break; case 4: Students.printContentStudentRecord(); break; case 5: Students.printStudentsList(); break; case 6: Students.sortByLastName(); break; case 7: Students.sortByGPA(); break; default: cout << "Error! option is not correct"; break; } }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!