public static void demo() { EnrollmentRulesFactory enrollFactoryObj = factory.getEnrollmentRuleObj(); List <String> enrollmentRegulationList = new List <String>(); //minAge, maxAge, num of Students, num of Teachers, groupSize enrollmentRegulationList.Add("6,12,4,1,3"); enrollmentRegulationList.Add("13,24,5,1,3"); enrollmentRegulationList.Add("25,35,6,1,3"); enrollmentRegulationList.Add("36,47,8,1,3"); enrollmentRegulationList.Add("48,59,12,1,2"); enrollmentRegulationList.Add("60,100,15,1,2"); DayCare day = factory.getDayCareObj(); day.setEnrollmentruleList(enrollFactoryObj.getRuleObj(enrollmentRegulationList)); List <String> rulesList = new List <String>(); String firstLine = "Age Group,\tgroupSize,\tratio,\tmaxGroups/Class"; rulesList.Add(firstLine); foreach (EnrollmentRules EnrollmentRules in day.getEnrollmentruleList()) { String rule = "" + EnrollmentRules.MinAge + "-" + EnrollmentRules.MaxAge + ",\t\t\t" + EnrollmentRules.GroupSize + ", \t\t\t" + EnrollmentRules.Ratio + ", \t\t\t" + EnrollmentRules.MaxGroup; rulesList.Add(rule); } System.IO.File.WriteAllLines(enrollmentRulesFileName, rulesList); createDayCareImmunizationRules(); //Teacher Factory object initialization TeacherFactory teacherFactoryObj = TeacherFactory.getTeacherFactoryObj(); List <String> teacher_data = System.IO.File.ReadLines(teacherFileName).ToList(); Console.WriteLine("Student File read successfully"); day.setTeacherList(teacherFactoryObj.getTeacherObj(teacher_data)); //Student Factory object inittialization StudentFactory studentFactoryObj = StudentFactory.getObj(); List <String> student_data = System.IO.File.ReadLines(studentFileName).ToList(); Console.WriteLine("Student File read successfully"); List <Student> studentList = studentFactoryObj.initStudentObj(student_data, false); day.enrollStudent(studentList); List <String> immunization_data = System.IO.File.ReadLines(immunizationFileName).ToList(); day.mapStudentIDToImmunizationData(immunization_data, studentList, day.getImmunizationFactoryInstance()); foreach (Classroom classroom in day.getClassroomList()) { //System.out.print("\nClassID:" + classroom.classroomID + "\tAge group:" + classroom.getEnrollmentRule().getMinAge() + "-" + classroom.getEnrollmentRule().getMaxAge() + "months"); foreach (Group group in classroom.getGroupList()) { //System.out.print("\n\tGroupID:" + group.getGroupID() + " Teacher Assigned:" + group.getTeacher().getFirstName() + "\n"); foreach (Student student in group.getStudentList()) { if (student.getImmunizationRecord() != null) { foreach (Immunization im in student.getImmunizationRecord()) { im.checkImmunizationStatus(student.DateOfBirth); } } } } } }
public void setEnrollmentFactoryObj(Factory.EnrollmentRulesFactory enrollmentFactoryObj) { this.enrollmentFactoryObj = enrollmentFactoryObj; }