Introduction.The Student Management System is a software applicationdesigned to efficiently manage and organize student information.This system offers a convenient and structured approac
Trang 1VIETNAM NATIONAL UNIVERSITY,
HANOI INTERNATIONAL SCHOOL
Trang 2Table of contents
I Introduction
II Design
III Implementation
1 Student Class Implementation
2 Stack Class Implementation
3 Main Program Implementation:
IV Results
1 Add student
2 Update student
3 Remove student
4 Show all students
5 Search for student by ID
6 Search for student by Name
7 Search for student by GPA
8 Sort Stack by ID
9 Sort Stack by GPA
V Conclusion
Trang 3I Introduction.
The Student Management System is a software applicationdesigned to efficiently manage and organize student information.This system offers a convenient and structured approach to storingand retrieving data related to students, including their personaldetails, academic records, and contact information
The primary goal of the Student Management System is tostreamline the process of managing student information, ensuringeasy accessibility, accurate data storage, and efficient datamanipulation By employing a stack data structure in itsimplementation, the system leverages the benefits of stackoperations such as push, pop, and peek, which allow for efficientinsertion, deletion, and retrieval of student records
Managing student information effectively is of paramountimportance in educational institutions, as it enables administrators,teachers, and support staff to maintain accurate and up-to-daterecords, facilitate communication with students and parents, andgenerate various reports and analyses for academic andadministrative purposes
The use of a stack data structure in the implementation of theStudent Management System offers several advantages The stack'slast-in-first-out (LIFO) property ensures that the most recentlyadded student record is easily accessible and modifiable.Additionally, the stack's efficient push-and-pop operations enablethe system to handle frequent updates and changes in studentinformation seamlessly
This report will delve into the design, implementation, andresults of the Student Management System We will explore thestructure and functionality of the Student and Stack classes,analyze the flow of control in the program, and discuss the benefitsand effectiveness of utilizing a stack data structure in the context ofstudent management
Trang 4II Design.
The design of the Student Management System encompassesthe structure and functionality of the software application Thissection will explore the key design aspects, including the classstructure, relationships, and the rationale behind utilizing a stackdata structure
The system is implemented using the C++ programminglanguage and consists of two main classes: the Student and Stackclasses The Student class represents an individual student andstores information such as the student's ID, name, address, phonenumber, email, date of birth, and GPA This class also providesgetter and setter functions to access and modify the student'sattributes
The Stack class represents a stack data structure that holdsStudent objects It is implemented using a linked list, where eachnode contains a Student object and a pointer to the next node TheStack class provides various functions to manipulate the stack,including push (to add a student to the top of the stack), pop (to
Trang 5remove and return the top student), peek (to access the top studentwithout removal), isEmpty (to check if the stack is empty), getSize(to retrieve the size of the stack), display (to print the stackcontents), remove (to remove a student by ID), find (to search for astudent based on a given condition), and sort (to sort the stackusing a comparison function).
The Student Management System employs a stack datastructure to store and manage student information The decision touse a stack is motivated by its LIFO (last-in-first-out) behavior,which aligns well with the requirements of managing studentrecords New students are added to the top of the stack, allowingeasy access and modification of the most recent student records
Trang 6This design choice ensures that the latest student information isreadily available and simplifies tasks such as updating, removing,and searching for student records.
The Student Management System follows a modular design,dividing the functionality into separate classes This promotesencapsulation, code reusability, and maintainability The use ofclasses allows for better organization and abstraction of thesystem's components, making the code easier to understand andmodify
Trang 7Overall, the design of the Student Management Systemfocuses on providing an efficient and organized approach tomanaging student information By utilizing the stack data structureand employing a modular class-based design, the system aims tostreamline the process of storing, retrieving, updating, andsearching for student records.
With the design of the Student Management Systemestablished, we can now move on to the implementation details
Trang 8The following section will delve into the coding aspects and provideinsights into how the system was realized in practice.
Trang 91 Student Class Implementation.
The Student class was implemented to represent an individualstudent and store relevant information The class contains privatedata members for the student's ID, name, address, phone number,email, date of birth, and GPA It also includes getter and setterfunctions to access and modify these attributes
Student Class Header File
// A class to store student information
string name ; // Student name
string address ; // Student address
string phone ; // Student phone number
string email ; // Student email
string dob ; // Student date of birth
double GPA ; // Student GPA
// Public member functions
Trang 10doublegetGPA ();
// Setter functions
void setName ( string );
void setAddress ( string );
void setPhone ( string );
void setEmail ( string );
void setDob ( string );
void setGPA (double);
or provided attribute values The getter functions retrieve thevalues of the student's attributes, while the setter functions modifythem The display function prints the student's information to theconsole
2 Stack Class Implementation.
The Stack class was implemented to represent a stack datastructure and provide the necessary operations for managingstudent records It is implemented using a linked list, where eachnode holds a Student object and a pointer to the next node
The Stack class provides various functions to manipulate thestack of student records The push function adds a new student tothe top of the stack, while the pop function removes and returns thestudent from the top of the stack The peek function allowsaccessing the top student without removing it The isEmptyfunction checks if the stack is empty, and the getSize functionreturns the current size of the stack
Stack Class Header File
Trang 11Student * data ; // The student data
Node * next ; // The pointer to the next node
friend class Stack ; // Class Stack can access the private members of class Node
public:
// Parameterized constructor
Node ( Student* data) {
this-> data =data;
this-> next = nullptr ;
}
};
private:
// Private data members
Node * top ; // The pointer to the top node of the stack
int size ; // The size of the stack
// Public member functions
// Push function to add a student to the top of the stack
void push ( Student* data);
// Pop function to remove and return the student from the top of the stack
Student* pop ();
// Peek function to return the student from the top of the stack without removing it
Student* peek ();
// IsEmpty function to check if the stack is empty
bool isEmpty () const;
// Size function to return the size of the stack
int getSize ()const;
// Display function to display the stack
void display ();
// Remove function to remove a student by ID
Student* remove (int);
Trang 12Student* find (function bool(< Student * ) > condition);
// Sort function to sort the stack using a std::function object
3 Main Program Implementation:
The main program logic is implemented in the `main`function It presents a menu-driven interface for interacting withthe Student Management System Users can choose various optionssuch as adding a student, updating student information, removing astudent, displaying the stack, searching for students by ID, name,
or GPA, and sorting the stack
The implementation utilizes the functionalities provided by theStudent and Stack classes to perform these operations efficiently.Users are prompted to enter the required information for eachoperation, and appropriate feedback is displayed to indicate thesuccess or failure of the requested action
Main (Driver) File
# include < iostream >
# include " Stack.h "
# include " Student.h "
using namespace std ;
#pragmaregion Global variables
Stack students ; // A stack to store students
string name ; // Student name
string address ; // Student address
string phone ; // Student phone number
Trang 13double GPA ; // Student GPA
Student * student ; // A pointer to a student
#pragmaendregion
#pragmaregion Function prototypes
void addStudent () {
cout << " Enter student name: ";
getline ( cin ignore (), name );
cout << " Enter student address: ";
getline ( cin , address );
cout << " Enter student phone number: ";
getline ( cin , phone );
cout << " Enter student email: ";
getline ( cin , email );
cout << " Enter student date of birth: ";
getline ( cin , dob );
cout << " Enter student GPA: ";
cin >> GPA ;
students push ( new Student ( name , address phone email dob GPA , , , , ));
cout << Student with ID " << students peek ()-> getID () << has been added to the stack successfully " << endl ;
cout << " Enter student name: ";
getline ( cin ignore (), name );
cout << " Enter student address: ";
getline ( cin , address );
cout << " Enter student phone number: ";
getline ( cin , phone );
cout << " Enter student email: ";
getline ( cin , email );
Trang 14cout << " Enter student GPA: ";
cin >> GPA ;
student -> setName ( name );
student -> setAddress ( address );
student -> setPhone ( phone );
student -> setEmail ( email );
student -> setDob ( dob );
student -> setGPA ( GPA );
Trang 15cout << " Student information: " << endl ;
student -> display ();
}
void searchByName () {
string name ;
cout << " Enter student name to search: ";
getline ( cin ignore (), name );
student students = find ([name]( Student* student) { returnstudent
Trang 16int choice ;
cout << " Welcome to the Student Management System " << endl ;
cout << " 1 Add a student to the stack " << endl ;
cout << " 2 Update a student in the stack " << endl ;
cout << " 3 Remove a student from the stack " << endl ;
cout << " 4 Display the stack " << endl ;
cout << " 5 Search for a student by ID " << endl ;
cout << " 6 Search for a student by Name " << endl ;
cout << " 7 Search for students by GPA " << endl ;
cout << " 8 Sort the stack by ID " << endl ;
cout << " 9 Sort the stack by GPA " << endl ;
cout << " 0 Exit " << endl ;
cout << " Enter your choice: ";
Trang 17Overall, the implementation successfully incorporates theStudent and Stack classes, providing a functional and user-friendlyStudent Management System.
Trang 18IV Results.
In this section, we present the results obtained from theimplementation of the Student Management System with stack Thesystem was tested using various scenarios and inputs to evaluate itsfunctionality, performance, and reliability This section provides anoverview of the outcomes observed during the testing phase
Welcome interface
1 Add student
Trang 192 Update student
3 Remove student
4 Show all students
Trang 205 Search for student by ID
6 Search for student by Name
7 Search for student by GPA
Trang 218 Sort Stack by ID
9 Sort Stack by GPA
Trang 22V Conclusion.
In conclusion, the Student Management System provides acomprehensive and efficient solution for managing studentinformation in educational institutions By utilizing a stack datastructure, the system ensures easy accessibility, accurate storage,and efficient manipulation of student records The benefits ofemploying a stack, such as the last-in-first-out property andefficient push and pop operations, contribute to the system'seffectiveness in handling frequent updates and changes in studentinformation
The Student Management System plays a crucial role inmaintaining accurate and up-to-date records, facilitatingcommunication with students and parents, and generating reportsand analyses for academic and administrative purposes Itsconvenient and structured approach to storing and retrieving datastreamlines the management of student information, enablingadministrators, teachers, and support staff to perform their rolesmore effectively
Throughout this report, we have explored the design,implementation, and results of the Student Management System
We have examined the structure and functionality of the Studentand Stack classes, analyzed the flow of control in the program, anddiscussed the advantages and effectiveness of utilizing a stack datastructure in the context of student management
In conclusion, the Student Management System serves as avaluable tool for educational institutions, empowering them toefficiently manage and organize student information With its use of
a stack data structure, the system provides a robust foundation forhandling student records, ensuring accuracy, accessibility, andease of manipulation The implementation of this system marks asignificant step forward in improving student informationmanagement processes, ultimately benefiting the entire educationalcommunity