static void Main(string[] args) { Student student1 = new Student(); Student student2 = new Student(); Student student3 = new Student(); Course course = new Course("Programming with C#"); course.Students(student1); course.Students(student2); course.Students(student3); Teacher teacher = new Teacher(); course.Teachers(teacher); Degree degree = new Degree("Bachelor"); degree.Courses(course); UProgram uProgram = new UProgram("Information Technology"); uProgram.Degrees(degree); List <Degree> degrees = uProgram.Degrees(); Console.WriteLine("The " + uProgram.Name + " program contains the " + degrees[0].Name + " of Science degree"); Console.WriteLine(); List <Course> courses = degrees[0].Courses(); Console.WriteLine("The " + degrees[0].Name + " of Science degree contains the course " + courses[0].Name); List <Student> students = courses[0].Students(); Console.WriteLine(); Console.WriteLine("The " + courses[0].Name + " course contains " + students.Count + " students(s)"); }
static void Main(string[] args) { Course c = new Course("Programming with C#"); c.students[0] = new Student("Steven", "Chiang", new DateTime(1992, 6, 23)); c.students[1] = new Student("Wolf", "Wang", new DateTime(1990, 9, 11)); c.students[2] = new Student("Mo", "Li", new DateTime(1991, 4, 15)); c.teachers[0] = new Teacher("Yu Je", "Li", new DateTime(1992, 6, 23)); Degree d = new Degree("Bachelor"); d.C = c; UProgram up = new UProgram("Information Technology"); up.D = d; Console.WriteLine("The {0} program contains the {1} of Science degree", up.ProgramName, up.D.DegreeName); Console.WriteLine("The {0} of Science degree contains the course {1}", d.DegreeName, d.C.CourseName); Console.WriteLine("The {0} course contains {1} student(s)", c.CourseName, Student.Count); }