import java.util.Arrays; public class School { private String[] students; private String[] teachers; private String[] classes; private int studentCount; private int teacherCount; private int classCount; private static final int INITIAL_CAPACITY = 10; public School() { this.students = new String[INITIAL_CAPACITY]; this.teachers = new String[INITIAL_CAPACITY]; this.classes = new String[INITIAL_CAPACITY]; this.studentCount = 0; this.teacherCount = 0; this.classCount = 0; } public void addStudent(String student) { if (studentCount < students.length) { students[studentCount++] = student; } else { System.out.println("Cannot add more students, array is full."); } } public void removeStudent(String student) { for (int i = 0; i < studentCount; i++) { if (students[i].equals(student)) { for (int j = i; j < studentCount - 1; j++) { students[j] = students[j + 1]; } students[--studentCount] = null; return; } } System.out.println("Student not found."); } public void addTeacher(String teacher) { if (teacherCount < teachers.length) { teachers[teacherCount++] = teacher; } else { System.out.println("Cannot add more teachers, array is full."); } } public void removeTeacher(String teacher) { for (int i = 0; i < teacherCount; i++) { if (teachers[i].equals(teacher)) { for (int j = i; j < teacherCount - 1; j++) { teachers[j] = teachers[j + 1]; } teachers[--teacherCount] = null; return; } } System.out.println("Teacher not found."); } public void createClass(String newClass) { if (classCount < classes.length) { classes[classCount++] = newClass; } else { System.out.println("Cannot add more classes, array is full."); } } public void printStudents() { System.out.println("Students:"); for (int i = 0; i < studentCount; i++) { System.out.println("- " + students[i]); } } public void printTeachers() { System.out.println("Teachers:"); for (int i = 0; i < teacherCount; i++) { System.out.println("- " + teachers[i]); } } public void printClasses() { System.out.println("Classes:"); for (int i = 0; i < classCount; i++) { System.out.println("- " + classes[i]); } } public static void main(String[] args) { School school = new School(); school.addStudent("Alice"); school.addStudent("Bob"); school.addStudent("Charlie"); school.addTeacher("Mr. Smith"); school.addTeacher("Ms. Johnson"); school.createClass("Math 101"); school.createClass("Science 102"); school.printStudents(); school.printTeachers(); school.printClasses(); school.removeStudent("Bob"); school.removeTeacher("Ms. Johnson"); System.out.println("\nAfter removal:"); school.printStudents(); school.printTeachers(); school.printClasses(); } }