Course Class¶
The Course class represents a university course within the School Enrollment System.
It stores all course-related information, manages enrollment, and maintains academic data such as assessments and assigned instructors.
Purpose¶
The purpose of the Course class is to:
- Model a course with all essential academic attributes
- Track enrolled students
- Store assessments and grades
- Manage enrollment status (open or closed)
- Support instructor assignment
- Provide validation and helper methods for safe course management
This class forms the core of the system’s academic structure.
Structure and key components¶
1. Enumerations¶
The class defines an enumeration for enrollment status:
OPENCLOSED
Using an enum ensures type safety and prevents invalid status values.
2. Attributes (private fields)¶
The Course class includes the following fields:
Basic information¶
courseNamecourseCodescheduledescription
Enrollment management¶
enrollmentStatuscapacityenrolledStudents(a list ofStudentobjects)
Academic details¶
grades(a list ofAssessmentobjects)creditHours
Instructor¶
instructor(anInstructorobject)
The enrolledStudents list is initialized during construction to avoid null references.
3. Constructors¶
Full constructor¶
Initializes all fields, ensuring the course object is fully populated.
Default constructor¶
Creates an empty course object, typically used during file loading or temporary object creation.
4. Setters and getters¶
Each field has corresponding getter and setter methods.
Validation rules include:
courseNameandcourseCodemust not be emptycapacitymust be a positive integercreditHoursmust be greater than zero- Invalid values trigger error messages and do not update the field
This defensive design prevents invalid course data from entering the system.
5. Methods¶
isFull¶
Determines whether the course has reached maximum capacity.
Behavior:
- Compares the size of
enrolledStudentswithcapacity - Returns
trueif the course is full, otherwisefalse
This method is used during enrollment to prevent over-enrollment.
Summary¶
The Course class models all essential aspects of a university course, including academic details, enrollment status, instructor assignment, and grade tracking.
Its validation logic and helper methods ensure that course data remains consistent and reliable throughout the system.
This class is central to the functionality of the School Enrollment System.