public static void Main(string[] args) { // declare students Student Joey = new Student("Joey", "Freshwater", 01); Student Jimmy = new Student("Jimmy", "Chestnut", 02); Student Lane = new Student("Lane", "Kiffin", 03); Student[] StudentArray = { Joey, Jimmy, Lane }; // declare teacher Teacher Butch = new Teacher("Butch", "Jones", 01); Teacher[] TeacherArray = { Butch }; // declare course Course Prog = new Course("Programming with C#", "P01", StudentArray, TeacherArray); Course[] CourseArray = { Prog }; // declare degree Degree Bach = new Degree("Bachelor of Science", CourseArray); Degree[] DegreeArray = { Bach }; // declare program UProgram IT = new UProgram("Information Technology", DegreeArray); Console.WriteLine("The {0} program contains the {1} degree.", IT.ProgramName, IT.ProgramDegree); Console.WriteLine("The {0} degree contains the course {1}.", Bach.DegreeName, Bach.DegreeCourse); Console.WriteLine("The {0} course contains {1} student(s).", Prog.CourseName, Student.SCount); }
static void Main(string[] args) { Student.Count = 0; Student student1 = new Student(); Student student2 = new Student(); Student student3 = new Student(); //Creating a Course object of name ProgrammingWithCSharp //Assigningthe Student objects array in it with the above created instances of Student Course ProgramminWithCSharp = new Course(); ProgramminWithCSharp.stuArray[0] = student1; ProgramminWithCSharp.stuArray[1] = student2; ProgramminWithCSharp.stuArray[2] = student3; ProgramminWithCSharp.CourseName = "Programming With C#"; //Assigning the teachers objects array in Course with the created Teacher class object Teacher teacher1 = new Teacher(); ProgramminWithCSharp.teaArray[0] = teacher1; //Assigning the Course object in Degree class with the created Teacher class object Degree Bachelor = new Degree(); Bachelor.courseVariable = ProgramminWithCSharp; Bachelor.Name = "Bachelor of Science"; //Assigning the Course object in Degree class with the created Teacher class object UProgram InfoTech = new UProgram(); InfoTech.degreeVariable = Bachelor; InfoTech.Name = "Information Technology"; Console.WriteLine(); Console.WriteLine("The {0} program contains the {1} degree.", InfoTech.Name, InfoTech.degreeVariable.Name ); Console.WriteLine("The {0} degree contains the course {1}.", Bachelor.Name, Bachelor.courseVariable.CourseName); Console.WriteLine("The {0} course contains {1} students.", ProgramminWithCSharp.CourseName, Student.Count); }