|
@ -50,6 +50,46 @@ public class Main { |
|
|
break; |
|
|
break; |
|
|
case 4: |
|
|
case 4: |
|
|
// Drop Prof from Course |
|
|
// Drop Prof from Course |
|
|
|
|
|
System.out.println("Please enter Professor ID"); |
|
|
|
|
|
String profID = scanner.next(); |
|
|
|
|
|
while(administration.findProfessorById(profID) == null){ |
|
|
|
|
|
System.out.println("This Professor does not exist"); |
|
|
|
|
|
System.out.println("Please enter a new Professor ID"); |
|
|
|
|
|
profID = scanner.next(); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
Professor prof = administration.findProfessorById(profID); |
|
|
|
|
|
List<Course> courseList = prof.getCoursesTaught(); |
|
|
|
|
|
|
|
|
|
|
|
System.out.println("Please enter Course ID"); |
|
|
|
|
|
String courseID = scanner.next(); |
|
|
|
|
|
|
|
|
|
|
|
boolean isDeleted = false; |
|
|
|
|
|
while(!isDeleted) { |
|
|
|
|
|
//Checks if course exists |
|
|
|
|
|
while(administration.findCourseByID(courseID) == null ){ |
|
|
|
|
|
System.out.println("This Course does not exist"); |
|
|
|
|
|
System.out.println("Please enter a new Course ID"); |
|
|
|
|
|
courseID = scanner.next(); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
//Checks if Prof is enrolled in course |
|
|
|
|
|
for (Course course : courseList) { |
|
|
|
|
|
if (course.getCourseID().equals(courseID)) { |
|
|
|
|
|
courseList.remove(administration.findCourseByID(courseID)); |
|
|
|
|
|
prof.setCoursesTaught(courseList); |
|
|
|
|
|
System.out.println("Course deleted successfully"); |
|
|
|
|
|
isDeleted = true; |
|
|
|
|
|
break; |
|
|
|
|
|
} |
|
|
|
|
|
System.out.println("The Professor is not enrolled in this course"); |
|
|
|
|
|
System.out.println("Please enter a new Course ID"); |
|
|
|
|
|
System.out.println("To return to main menu enter '0'"); |
|
|
|
|
|
courseID = scanner.next(); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
break; |
|
|
break; |
|
|
case 5: |
|
|
case 5: |
|
|
// Drop Student from Course |
|
|
// Drop Student from Course |
|
|