示例#1
0
        static void Main(string[] args)
        {
            //GetStudentInformation();    // birthday not implemented exception has been used in this funcion
            //Console.WriteLine("\n\n");
            //GetTeacherInformation();
            //Console.WriteLine("\n\n");
            //GetCourseInformation();
            //Console.WriteLine("\n\n");
            //GetProgramInformation();
            //Console.WriteLine("\n\n");
            //GetDegreeInformation();

            //Console.WriteLine("\n\nPress any to exit ...");
            //Console.ReadLine();

            // 1. Instantiate three Student objects.
            Student student1 = new Student("Ali", "Zamani", new DateTime(1984, 02, 20),
                "Industrisgaran 48", "LGH 1102", "Linkoping", "Ostergorland", "595 81", "Sweden");
            student1.Grades.Push("A");
            student1.Grades.Push("B");
            student1.Grades.Push("C");
            student1.Grades.Push("D");
            student1.Grades.Push("E");

            Student student2 = new Student("Hamed", "Khedmati", new DateTime(1984, 03, 10),
                "Vali Asr Street", "LGH 1102", "Tehran", "Tehran", "595 11", "Iran");
            student2.Grades.Push("A");
            student2.Grades.Push("B");
            student2.Grades.Push("C");
            student2.Grades.Push("D");
            student2.Grades.Push("E");

            Student student3 = new Student("Maryam", "Farzad", new DateTime(1955, 10, 7),
                "Fifth Avenue", "LGH 1102", "Folsom", "California", "595 81", "USA");
            student3.Grades.Push("A");
            student3.Grades.Push("B");
            student3.Grades.Push("C");
            student3.Grades.Push("D");
            student3.Grades.Push("E");

            // 2. Instantiate a Course object called Programming with C#.
            Course cSharpCourse = new Course("Programming with C#", 15, 5, "Bill Gates");

            // 3. Add your three students to this Course object.
            cSharpCourse.RegisterStudent(student1);
            cSharpCourse.RegisterStudent(student2);
            cSharpCourse.RegisterStudent(student3);

            // 4. Instantiate at least one Teacher object.
            Teacher teacher = new Teacher("Bill", "Gates", new DateTime(1955, 10, 28),
                "Fifth Avenue", "LGH 1102", "Folsom", "California", "595 81", "USA");

            // 5. Add that Teacher object to your Course object
            cSharpCourse.RegisterTeacher(teacher);

            // 6. Instantiate a Degree object, such as Bachelor.
            Degree bachelorDegree = new Degree("Bachelor of Science", 180);

            // 7. Add your Course object to the Degree object.
            bachelorDegree.Course = cSharpCourse;

            // 8. Instantiate a UProgram object called Information Technology.
            UProgram itProgram = new UProgram("Information Technology", teacher);

            // 9. Add the Degree object to the UProgram object.
            itProgram.Degrees = bachelorDegree;

            // 10.1 The name of the program and the degree it contains
            Console.WriteLine("The {0} contains the {1} degree.", itProgram.Name, itProgram.Degrees.Name);

            // 10.2 The name of the course in the degree
            Console.WriteLine("The {0} degree contains the course {1}.", itProgram.Degrees.Name, itProgram.Degrees.Course.Name);

            // 10.3 The count of the number of students in the course.
            Console.WriteLine("The {0} course contains {1} students.", itProgram.Degrees.Course.Name, Student.StudentEnrolledTotal);

            Console.WriteLine("\n\n");

            student1.DeliverAssignment();
            teacher.GradeAssignment();
            student2.TakeFinalExam();
            teacher.GradeFinalExam();

            Console.WriteLine("\n\n");

            cSharpCourse.ListStudents();

            Console.WriteLine("\n\nPress any to exit ...");
            Console.ReadLine();
        }
示例#2
0
 public void RegisterTeacher(Teacher newTeacher)
 {
     teacherList.Add(newTeacher);
 }