import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner input = new Scanner(System.in); // Courses Course ap = new Course("Advanced Programming", "AP1404", 2); Course ds = new Course("Data Structures", "DS2201", 1); Course db = new Course("Database Systems", "DB3301", 3); // System RegistrationSystem system = new RegistrationSystem(); system.addCourseToSystem(ap); system.addCourseToSystem(ds); system.addCourseToSystem(db); // Student System.out.print("Enter student name: "); String name = input.nextLine(); System.out.print("Enter student id: "); String id = input.nextLine(); Student student = new Student(name, id); int choice = 0; while (choice != 5) { System.out.println("\n--- MENU ---"); System.out.println("1. Show all courses"); System.out.println("2. Register course"); System.out.println("3. Drop course"); System.out.println("4. Show my courses"); System.out.println("5. Exit"); System.out.print("Choice: "); choice = input.nextInt(); input.nextLine(); switch (choice) { case 1: system.showAllCourses(); break; case 2: System.out.print("Enter course code: "); String regCode = input.nextLine(); Course c1 = system.findCourseByCode(regCode); if (c1 != null) { student.addCourse(c1); } else { System.out.println("Course not found"); } break; case 3: System.out.print("Enter course code: "); String dropCode = input.nextLine(); Course c2 = system.findCourseByCode(dropCode); if (c2 != null) { student.dropCourse(c2); } else { System.out.println("Course not found"); } break; case 4: student.showRegisteredCourses(); break; case 5: System.out.println("Goodbye!"); break; default: System.out.println("Invalid choice"); } } } }