import java.util.Scanner;

public class ${CLASS_NAME}{
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int[] id = new int[100];
        String[] name = new String[100];
        int[] credits = new int[100];
        int count = 0;
        int choice;
        int key;

        do {
            System.out.println("\n===== Course Management System =====");
            System.out.println("1. Add Record");
            System.out.println("2. View All Records");
            System.out.println("3. Search Record");
            System.out.println("4. Update Record");
            System.out.println("5. Delete Record");
            System.out.println("6. Exit");
            System.out.print("Please choose an option: ");
            choice = sc.nextInt();

            switch (choice) {

                case 1:
                    if (count >= 100) {
                        System.out.println("Cannot add more items. Storage is full.");
                        break;
                    }
                    System.out.print("Enter Course ID: ");
                    id[count] = sc.nextInt();
                    System.out.print("Enter Course Name: ");
                    sc.nextLine();
                    name[count] = sc.nextLine();
                    System.out.print("Enter Credits: ");
                    credits[count] = sc.nextInt();
                    count++;
                    System.out.println("Added successfully!");
                    break;

                case 2:
                    if (count == 0) {
                        System.out.println("No Records Found.");
                    }
                    else {
                        System.out.println("\n===== Records (Course ID | Course Name | Credits) =====");
                        for (int i = 0; i < count; i++) {
                            System.out.println((i + 1) + ". " + id[i] + " | " + name[i] + " | " + credits[i]);
                        }
                    }
                    break;

                case 3:
                    System.out.print("Enter Course ID to Search: ");
                    key = sc.nextInt();
                    {
                        boolean found = false;
                        for (int i = 0; i < count; i++) {
                            if (id[i] == key) {
                                System.out.println("Found: " + id[i] + " | " + name[i] + " | " + credits[i]);
                                found = true;
                            }
                        }
                        if (!found) System.out.println("No matching record was found.");
                    }
                    break;

                case 4:
                    System.out.print("Enter Course ID to Update: ");
                    key = sc.nextInt();
                    {
                        boolean found = false;
                        for (int i = 0; i < count; i++) {
                            if (id[i] == key) {
                            System.out.print("Enter New Course ID: ");
                            id[i] = sc.nextInt();
                            System.out.print("Enter New Course Name: ");
                            sc.nextLine();
                            name[i] = sc.nextLine();
                            System.out.print("Enter New Credits: ");
                            credits[i] = sc.nextInt();
                                System.out.println("Updated successfully!");
                                found = true;
                                break;
                            }
                        }
                        if (!found) System.out.println("No matching record was found.");
                    }
                    break;

                case 5:
                    System.out.print("Enter Course ID to Delete: ");
                    key = sc.nextInt();
                    {
                        boolean found = false;
                        for (int i = 0; i < count; i++) {
                            if (id[i] == key) {
                                for (int j = i; j < count - 1; j++) {
                                    id[j] = id[j + 1];
                            name[j] = name[j + 1];
                            credits[j] = credits[j + 1];
                                }
                                count--;
                                System.out.println("Deleted successfully!");
                                found = true;
                                break;
                            }
                        }
                        if (!found) System.out.println("No matching record was found.");
                    }
                    break;

                case 6:
                    System.out.println("Thank You for Using Course Management System.");
                    break;

                default:
                    System.out.println("Invalid Choice.");
            }

        } while (choice != 6);

        sc.close();
    }
}