private void addStudent(StudentDirectory dir2, int i) { String id = "" + i; Student student = new Student(id); student.setId(id); student.addCredits(i); dir.add(student); }