diff --git a/src/main/java/org/example/Main.java b/src/main/java/org/example/Main.java index f41f76d..ed91152 100644 --- a/src/main/java/org/example/Main.java +++ b/src/main/java/org/example/Main.java @@ -1,4 +1,6 @@ package org.example; +import java.util.ArrayList; +import java.util.List; import java.util.Scanner; public class Main { @@ -44,6 +46,27 @@ public class Main { break; case 3: // Enroll Prof to 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(); + } + System.out.println("Please enter Course ID"); + String courseID = scanner.next(); + 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(); + } + Professor prof = administration.findProfessorById(profID); + Course course = administration.findCourseByID(courseID); + List courseList = prof.getCoursesTaught(); + courseList.add(course); + prof.setCoursesTaught(courseList); + break; case 4: // Drop Prof from Course