static void Main(string[] args) { Student[] students = new Student[3] { new Student("John", "Doe", "1/1/1900"), new Student("Sally", "Jones", "2/21/1951"), new Student("Bob", "Smith", "9/2/2001") }; Course progWithCSharp = new Course("Programming with C#"); progWithCSharp.AddStudent(students[0]); progWithCSharp.AddStudent(students[1]); progWithCSharp.AddStudent(students[2]); 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"); }
public void AddDegree(Degree degree) { Degree[] tmpDeg; if (degCnt < 1) { degCnt++; degrees = new Degree[degCnt]; degrees[0] = degree; } else { degCnt++; tmpDeg = new Degree[degCnt]; for (int i = 0; i < degCnt - 1; i++) { tmpDeg[i] = degrees[i]; } tmpDeg[degCnt - 1] = degree; degrees = new Degree[degCnt]; degrees = tmpDeg; } }