Class Laboratory: Student Management
System
Part 1:
Begin by analyzing the provided Student class skeleton. In your groups, discuss the following
questions:
1. What is a constructor? How do they differ from other member functions?
2. What is an initializer list and why is it useful?
3. How many constructors does our Student class need, and what parameters should
each have?
4. What validations should we implement for student data (ID, name, age, GPA)?
Document your answers for later discussion.
Part 2: Implementing the Student Class
Complete the implementation of the Student class with the following specifications:
1. Private data members:
o ID (string)
o firstName (string)
o lastName (string)
o age (int)
o gpa (double)
2. Constructors:
o Default constructor: Set ID to "0000", firstName and lastName to "Unknown",
age to 18, and GPA to 0.0
o Parameterized constructor with ID, firstName, and lastName: Use an
initializer list, set age to 18 and GPA to 0.0
o Full parameterized constructor with all parameters: Use an initializer list and
include validation
3. Data validation (implement these in both constructors and setter methods):
o ID must be exactly 4 digits
o firstName and lastName cannot be empty and must be less than 30 characters
o age must be between 16 and 100
o GPA must be between 0.0 and 4.0
4. Member functions:
o Getters and setters for all data members (with validation in setters)
o displayInfo() function to output all student information
o calculateStanding() function that returns a string ("Excellent", "Good",
"Average", "Poor") based on GPA
Test your implementation by creating Student objects with various parameters.
Part 3: Creating a Course Class
Create a Course class that works with the Student class:
1. Private data members:
o courseCode (string)
o courseName (string)
o instructor (string)
o maxStudents (int) - defaults to 30
o enrolledStudents (a fixed-size array of Student objects, size 50)
o currentEnrollment (int) - to track how many students are enrolled
2. Constructors:
o Default constructor: Set courseCode to "EEE000", courseName to "Unknown
Course", instructor to "Staff"
o Parameterized constructor with courseCode, courseName, and instructor: Use
an initializer list
o Additional constructor that also sets maxStudents: Use an initializer list with
validation
3. Member functions:
o Getters and setters with validation
o enrollStudent(Student student) function that adds a student to the course if
there's space
o dropStudent(string studentID) function that removes a student from the course
o displayCourseInfo() function to output course information
o displayEnrollment() function to list all enrolled students
Implement the necessary validation in all constructors and setter methods.
Extension Exercise (Optional)
If your group finishes the main lab early, implement the following enhancements:
1. Add a member function to the Course class to find the student with the highest GPA
2. Create a member function to generate a report showing grade distribution (how many
students in each standing category)
3. Implement a feature to sort the enrolled students by GPA, name, or ID
4. Create a simple menu-driven interface in main() that allows a user to:
o Add new students
o Enroll students in courses
o Display course information
o Search for a student by ID
Submission Requirements
Each group should submit:
1. The complete source code for all parts
2. A brief document (1page) answering the questions from Part 1 and explaining your
implementation approach
3. A demonstration of your program execution with sample output
4. Submission deadline to communicated in Moodle