public class test{ public static void main(String []args){ //========================================================================================================== //create a school School my_school = new School("Salim Halim Pasa Lisesi", 20); //========================================================================================================== //create a student Student serkan = new Student("Serkan", "cs", "freshman", 5); //========================================================================================================== //try to register a new student, notify user the result if(!my_school.addStudent(serkan)) System.out.println("Cannot register student " + serkan.listName() + " to the school, max student number reached"); else System.out.println("Student " + serkan.listName() + " successfully registered"); System.out.println(); //========================================================================================================== //create new courses Course cs101 = new Course("Introduction to Programming", "CS101", 40); Course math403 = new Course("Real Analysis", "MATH403", 20); Course gg303 = new Course("Introduction to Fuid Mechanics", "GG303", 0); Course cs456 = new Course("Introduction to introduction", "CS456", 15); //========================================================================================================== //add these courses to shool's course list if(my_school.createACourse(cs101)) System.out.println("Course " + cs101.getCourseName() + " added to list succesfully"); else System.out.println("Course " + cs101.getCourseName() + " could not be added to list"); if(my_school.createACourse(math403)) System.out.println("Course " + math403.getCourseName() + " added to list succesfully"); else System.out.println("Course " + math403.getCourseName() + " could not be added to list"); if(my_school.createACourse(gg303)) System.out.println("Course " + gg303.getCourseName() + " added to list succesfully"); else System.out.println("Course " + gg303.getCourseName() + " could not be added to list"); System.out.println(); //========================================================================================================== //create another student, register him to scholl, and to Real Analysis Student aykut = new Student("Aykut", "Math", "junior", 4); my_school.addStudent(aykut); my_school.registerStudentToCourse(math403, aykut); //========================================================================================================== //attempt to add serkan to course math403 if(my_school.registerStudentToCourse(math403, serkan)) System.out.println("Student" + serkan.listName() + " was added to the course " + math403.getCourseName() + " successfully"); else System.out.println("Student " + serkan.listName() + " could not be added to the course " + math403.getCourseName()); System.out.println(); //========================================================================================================== //attempt to remove a course from the list //(should give create an error since school does not have the course) if(!my_school.removeCourse(cs456)) System.out.println("Course " + cs456.getCourseName() + " could not be removed"); else System.out.println("Course " + cs456.getCourseName() + " removed successfully"); System.out.println(); //========================================================================================================== //attempt to add student to a course whose quota has been reached (should give an error) if(!my_school.registerStudentToCourse(gg303, serkan)) System.out.println("Student " + serkan.listName() + " could not be added to the course " + gg303.getCourseName()); else System.out.println("Student" + serkan.listName() + " was added to the course " + gg303.getCourseName() + " successfully"); System.out.println(); //========================================================================================================== //attempt to register a student to a course that he is already registered if(my_school.registerStudentToCourse(math403, serkan)) System.out.println("Student" + serkan.listName() + " was added to the course " + math403.getCourseName() + " successfully"); else System.out.println("Student " + serkan.listName() + " could not be added to the course " + math403.getCourseName()); System.out.println(); //========================================================================================================== //attempt to remove a course from students course list to get an error since student //is not registered to the course if(!my_school.removeStudentFromCourse(cs101, serkan)) System.out.println("An error occurred while removing " + serkan.listName() + " from course " + cs101.getCourseName()); else System.out.println(serkan.listName() + "removed from the course " + cs101.getCourseName()); System.out.println(); //========================================================================================================== //print the list of students taking Real Analysis System.out.println("Following students are registered to " + math403.getCourseName()); for(int k = 0; k < math403.getStudentCount(); ++k){ System.out.println(math403.getStudentAtIndex(k).listName()); } System.out.println(); //========================================================================================================== //printf all courses taught in this school System.out.println("Following courses are taught in this school:"); for(int k = 0; k < my_school.getCourseNumber(); ++k){ System.out.println(my_school.getCourseAtIndex(k).getCourseName()); } System.out.println(); } }