Example #1
0
 public void addGrade(Grade g)
 {
     this.grades.Add(g);
 }
        private void initCursusINFDLM1()
        {
            cursus = new Cursus(2016, "inf dlm", 3);

            List<StudyYear> studyYears = new List<StudyYear>();
            studyYears.Add(new StudyYear(2013));
            studyYears.Add(new StudyYear(2014));
            studyYears.Add(new StudyYear(2015));

            cursus.StudyYears = studyYears;

            Module m1 = new Module("Sciences IA");
            Module m2 = new Module("Sciences IB");
            Module m3 = new Module("Programmation I");

            studyYears.ElementAt(0).Modules.Add(m1);
            studyYears.ElementAt(0).Modules.Add(m2);
            studyYears.ElementAt(0).Modules.Add(m3);

            Lecture l1_1 = new Lecture("Math IA", 3);
            Lecture l1_2 = new Lecture("Physique IA", 2);
            m1.Lectures.Add(l1_1);
            m1.Lectures.Add(l1_2);

            Lecture l2_1 = new Lecture("Math IB", 5);
            Lecture l2_2 = new Lecture("Physique IB", 3);
            Lecture l2_3 = new Lecture("Labo Physique IB", 2);
            m2.Lectures.Add(l2_1);
            m2.Lectures.Add(l2_2);
            m2.Lectures.Add(l2_3);

            Lecture l3_1 = new Lecture("Langage C", 3);
            Lecture l3_2 = new Lecture("Langage C++", 3);
            Lecture l3_3 = new Lecture("Algo I", 4);
            Lecture l3_4 = new Lecture("Assembleur", 2);
            m3.Lectures.Add(l3_1);
            m3.Lectures.Add(l3_2);
            m3.Lectures.Add(l3_3);
            m3.Lectures.Add(l3_4);

            Grade g1_1 = new Grade(4, 1);
            Grade g1_2 = new Grade(5, 1);
            Grade g1_3 = new Grade(5, 1);
            l1_1.Grades.Add(g1_1);
            l1_1.Grades.Add(g1_2);
            l1_1.Grades.Add(g1_3);

            Grade g2_1 = new Grade(5, 1);
            Grade g2_2 = new Grade(5.5, 1);
            Grade g2_3 = new Grade(4, 1);
            l1_2.Grades.Add(g2_1);
            l1_2.Grades.Add(g2_2);
            l1_2.Grades.Add(g2_3);

            Grade g3_1 = new Grade(4, 1);
            Grade g3_2 = new Grade(4.2, 1);
            Grade g3_3 = new Grade(4.8, 0.5);
            Grade g3_4 = new Grade(4.6, 0.5);
            l2_1.Grades.Add(g3_1);
            l2_1.Grades.Add(g3_2);
            l2_1.Grades.Add(g3_3);
            l2_1.Grades.Add(g3_4);

            Grade g4_1 = new Grade(5, 1);
            Grade g4_2 = new Grade(5.6, 1);
            Grade g4_3 = new Grade(5.3, 1);
            l2_2.Grades.Add(g4_1);
            l2_2.Grades.Add(g4_2);
            l2_2.Grades.Add(g4_3);

            Grade g5_1 = new Grade(4, 1);
            Grade g5_2 = new Grade(3.5, 0.5);
            Grade g5_3 = new Grade(3.2, 2);
            l2_3.Grades.Add(g5_1);
            l2_3.Grades.Add(g5_2);
            l2_3.Grades.Add(g5_3);

            Console.WriteLine(g5_1.getValue());
            Console.WriteLine(g5_1.getAverage());
            Console.WriteLine(g5_2.getValue());
            Console.WriteLine(g5_2.getAverage());
            
            Console.WriteLine("grades count: " + l2_3.Grades.Count);
            Console.WriteLine("lecture average: " + l2_3.getAverage());

            Console.WriteLine("m1 average: " + m1.getAverage());
            Console.WriteLine("m2 average: " + m2.getAverage());
            Console.WriteLine("m3 average: " + m3.getAverage());            
        }