コード例 #1
0
 public void addTeacher(Teacher teacher)
 {
     int n = this.teachers.Count;
     if (n < maxTeachers)
     {
         this.teachers.Add(teacher);
     }
     else
     {
         Console.WriteLine("Array of teachers is full.");
     }
 }
コード例 #2
0
        static void Main(string[] args)
        {
            int i,grade;

            Student s1 = new Student(), s2 = new Student(), s3 = new Student();
            Teacher t1 = new Teacher(), t2 = new Teacher();
            Course ProgrammingWithCSharp = new Course("Programming with C#");

            //set all students' name
            s1.FirstName = "S1_F";
            s2.FirstName = "S2_F";
            s3.FirstName = "S3_F";

            s1.LastName = "S1_L";
            s2.LastName = "S2_L";
            s3.LastName = "S3_L";

            //set all students' grades
            s1.EnterGrades();
            s2.EnterGrades();
            s3.EnterGrades();

            //add all student to course class
            ProgrammingWithCSharp.AddStudent(s1);
            ProgrammingWithCSharp.AddStudent(s2);
            ProgrammingWithCSharp.AddStudent(s3);

            //add two teacher to course class
            ProgrammingWithCSharp.AddTeacher(t1);
            ProgrammingWithCSharp.AddTeacher(t2);

            //add course to degree
            Degree Bachelor = new Degree("Bachelor");
            Bachelor.AddCourse(ProgrammingWithCSharp);

            //add degree to uprogram
            UProgram InformationTechnology = new UProgram("Information Technology");
            InformationTechnology.AddDegree(Bachelor);

            //list students' name
            ProgrammingWithCSharp.ListStudents();

            //list all students' grades
            s1.ListGrades();
            s2.ListGrades();
            s3.ListGrades();

            Console.ReadLine();
        }
コード例 #3
0
 public void AddTeacher(Teacher t)
 {
     if (teacher_num >= SIZE)
         throw new IndexOutOfRangeException("Number of teacher can't be more than 3");
     arr_teacher[teacher_num++] = t;
 }