diff --git a/src/main/java/org/example/Administration.java b/src/main/java/org/example/Administration.java index d6851e3..180e9c0 100644 --- a/src/main/java/org/example/Administration.java +++ b/src/main/java/org/example/Administration.java @@ -586,6 +586,16 @@ public class Administration { System.out.println("Student with ID " + studentId + " not found."); } } + public void deleteCourseWithInput(Scanner scanner) { + System.out.print("Enter the Course ID of the course you wish to delete: "); + String courseIDToDelete = scanner.next(); + boolean isDeleted = deleteCourse(courseIDToDelete); + if (isDeleted) { + System.out.println("Course with ID " + courseIDToDelete + " has been successfully deleted."); + } else { + System.out.println("Course with ID " + courseIDToDelete + " not found."); + } + } } diff --git a/src/main/java/org/example/Main.java b/src/main/java/org/example/Main.java index ef9fa77..2b338ac 100644 --- a/src/main/java/org/example/Main.java +++ b/src/main/java/org/example/Main.java @@ -74,14 +74,7 @@ public class Main { break; case 7: // Delete Course - System.out.println("Enter the Course ID of the course you wish to delete:"); - String courseIDToDelete = scanner.next(); - boolean isDeleted = administration.deleteCourse(courseIDToDelete); - if (isDeleted) { - System.out.println("Course with ID " + courseIDToDelete + " has been successfully deleted."); - } else { - System.out.println("Course with ID " + courseIDToDelete + " not found."); - } + administration.deleteCourseWithInput(scanner); break; case 8: administration.viewCourses();