add course registration starter code
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
package CourseRegistrationStarter;
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class Student {
|
||||
private String name;
|
||||
private String studentId;
|
||||
private ArrayList<Course> registeredCourses;
|
||||
|
||||
public Student(String name, String studentId) {
|
||||
this.name = name;
|
||||
this.studentId = studentId;
|
||||
this.registeredCourses = new ArrayList<>();
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public String getStudentId() {
|
||||
return studentId;
|
||||
}
|
||||
|
||||
public boolean addCourse(Course c) {
|
||||
// TODO: Register the student in the course if capacity allows
|
||||
// Return true if registration was successful, otherwise false
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean dropCourse(Course c) {
|
||||
// TODO: Remove the course from the student's list
|
||||
// Restore the course capacity if removal was successful
|
||||
// Return true if the course was dropped, otherwise false
|
||||
return false;
|
||||
}
|
||||
|
||||
public void showRegisteredCourses() {
|
||||
// TODO: Print all registered courses
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user