Package com.project.system
Class Course
java.lang.Object
com.project.system.Course
The
Course
class represents a course in the Student-Course Registration System.
It contains the course name, description, and a list of enrolled students.-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected void
enrollStudent
(String studentName) Enrolls a new student into the course.protected String
Gets the description of the course.Gets the list of students enrolled in the course.protected String
getName()
Gets the name of the course.protected void
setDescription
(String description) Sets the description of the course.protected void
setEnrolledStudents
(List<String> students) Sets the list of enrolled students for the course.
-
Field Details
-
NAME
The name of the course (final and immutable). -
description
A brief description of the course. -
enrolledStudents
A list of students enrolled in the course.
-
-
Constructor Details
-
Course
Constructs a newCourse
instance with a name and description. Initializes an empty list of enrolled students.- Parameters:
NAME
- The name of the course.description
- The description of the course.
-
-
Method Details
-
getName
Gets the name of the course.- Returns:
- The name of the course.
-
getDescription
Gets the description of the course.- Returns:
- The course description.
-
setDescription
Sets the description of the course.- Parameters:
description
- The new description to set.
-
getEnrolledStudents
Gets the list of students enrolled in the course.- Returns:
- A list of enrolled students.
-
enrollStudent
Enrolls a new student into the course.- Parameters:
studentName
- The name of the student to enroll.
-
setEnrolledStudents
Sets the list of enrolled students for the course.- Parameters:
students
- The list of students to be set.
-