Beispiel #1
0
        static void Main(string[] args)
        {
            Student studentA = new Student("John", "Doe", "1/1/1900");
            Student studentB = new Student("Sally", "Jones", "2/21/1951");
            Student studentC = new Student("Bob", "Smith", "9/2/2001");

            Course progWithCSharp = new Course("Programming with C#");
            progWithCSharp.AddStudent(studentA);
            progWithCSharp.AddStudent(studentB);
            progWithCSharp.AddStudent(studentC);

            Teacher teacherA = new Teacher("Paul", "Burns", "10/10/1975");
            progWithCSharp.AddTeacher(teacherA);

            Degree bachelor = new Degree("Bachelor of Science");
            bachelor.AddCourse(progWithCSharp);

            UProgram informationTechnology = new UProgram("Information Technology");
            informationTechnology.AddDegree(bachelor);

            Console.WriteLine(informationTechnology);
            Console.WriteLine(bachelor);
            Console.WriteLine(progWithCSharp);
            Console.WriteLine("\n");
        }
Beispiel #2
0
        public void AddCourse(Course course)
        {
            Course[] tmpCourse;

            if (courseCnt < 1)
            {
                courseCnt++;
                courses = new Course[courseCnt];
                courses[0] = course;
            }
            else
            {
                courseCnt++;
                tmpCourse = new Course[courseCnt];
                for (int i = 0; i < courseCnt - 1; i++)
                {
                    tmpCourse[i] = courses[i];
                }
                tmpCourse[courseCnt - 1] = course;
                courses = new Course[courseCnt];
                courses = tmpCourse;
            }
        }