|
|
@ -407,6 +407,31 @@ public class Administration { |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
public void enrollProfInCourse(){ |
|
|
|
|
|
|
|
System.out.println("Please enter Professor ID"); |
|
|
|
String profID = scanner.next(); |
|
|
|
while(this.findProfessorById(profID) == null){ |
|
|
|
System.out.println("This Professor does not exist"); |
|
|
|
System.out.println("Please enter a new Professor ID"); |
|
|
|
profID = scanner.next(); |
|
|
|
} |
|
|
|
System.out.println("Please enter Course ID"); |
|
|
|
String courseID = scanner.next(); |
|
|
|
while(this.findCourseByID(courseID) == null){ |
|
|
|
System.out.println("This Course does not exist"); |
|
|
|
System.out.println("Please enter a new Course ID"); |
|
|
|
courseID = scanner.next(); |
|
|
|
} |
|
|
|
Professor prof = this.findProfessorById(profID); |
|
|
|
Course course = this.findCourseByID(courseID); |
|
|
|
List<Course> courseList = prof.getCoursesTaught(); |
|
|
|
courseList.add(course); |
|
|
|
prof.setCoursesTaught(courseList); |
|
|
|
System.out.println("Professor enrolled successfully"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|