예제 #1
0
파일: Lesson.cs 프로젝트: 3A9C/ITstep
        public void ManageLesson()
        {
            Console.WriteLine("Lesson is begins!");

            Mark mark1 = new Mark(teacher, pupil_group.pupils[0], "home work", 10);
            Mark mark2 = new Mark(teacher, pupil_group.pupils[1], "class work", 10);
            Mark mark3 = new Mark(teacher, pupil_group.pupils[2], "good actions", 10);
            Mark mark4 = new Mark(teacher, pupil_group.pupils[3], "home work", 10);
            Mark[] marksss = new Mark[] { mark1, mark2, mark3, mark4};

            marks.Add(mark1);
            marks.Add(mark2);
            marks.Add(mark3);
            marks.Add(mark4);

            foreach(var mark in marks)
            {
                mark.Show();
            }
            XmlSerializer formatter = new XmlSerializer(typeof(Mark[]));
            using (FileStream fs = new FileStream("../../people.xml", FileMode.OpenOrCreate))
            {
                formatter.Serialize(fs, marksss);
            }


            Console.WriteLine("Lesson is finished!");

        }
예제 #2
0
        // non-static methods
        public void GiveMark(Lecture lecture, Mark mark)
        {
            if (lecture.studyGroup.listOfPupils.Contains(mark.pupil) == false)
            {
                throw new InvalidOperationException("In Teacher.GiveMark(StudyGroup, Mark, Pupil): there isn't this pupil in this group.");
            }

            lecture.marks.Add(mark);
        }