diff --git a/src/main/java/org/example/Administration.java b/src/main/java/org/example/Administration.java index 180e9c0..4970258 100644 --- a/src/main/java/org/example/Administration.java +++ b/src/main/java/org/example/Administration.java @@ -597,6 +597,18 @@ public class Administration { } } + public void createCourseWithInput(Scanner scanner) { + System.out.print("Enter Course Name: "); + String courseName = scanner.next(); + System.out.print("Enter Course ID: "); + String courseID = scanner.next(); + System.out.print("Enter Credits: "); + int credits = scanner.nextInt(); + Course newCourse = new Course(courseName, courseID, credits); + addCourse(newCourse); + System.out.println("Course created successfully."); + } + } diff --git a/src/main/java/org/example/Main.java b/src/main/java/org/example/Main.java index 2b338ac..47a62e1 100644 --- a/src/main/java/org/example/Main.java +++ b/src/main/java/org/example/Main.java @@ -64,13 +64,7 @@ public class Main { break; case 6: // Create Course - System.out.println("Enter Course Name:"); - String courseName = scanner.next(); - System.out.println("Enter Course ID:"); - String courseID = scanner.next(); - System.out.println("Enter Credits:"); - int credits = scanner.nextInt(); - administration.createCourse(courseName, courseID, credits); + administration.createCourseWithInput(scanner); break; case 7: // Delete Course