public void addCourse(String ID, String name, String coordinatorID) throws CourseExistsException, CourseInputInvalidException {
int maxCourseID = 21;
int maxCourseName = 38;
if (ID.isEmpty() || name.isEmpty()) {
throw new CourseInputInvalidException("Empty input fields.");
} else if (ID.length() > maxCourseID) {
throw new CourseInputInvalidException("Course ID is too long.");
} else if (name.length() > maxCourseName) {
throw new CourseInputInvalidException("Course name is too long");
} else if (!ID.matches("^[a-zA-Z_$0-9.-]+$")) {
throw new CourseInputInvalidException("Invalid course name with special characters.");
} else if (getCourse(ID) != null) {
throw new CourseExistsException();
}