Example #1
0
        private static List <Elev> Average(List <Elev> students)
        {
            double average = 0;

            foreach (var student in students)
            {
                average = student.GetAverage(student.Grades);
                Elev elev = new Elev(student.Name, student.Name, average);
                studentsAverage.Add(elev);
            }

            return(studentsAverage);
        }
Example #2
0
        private static List <Elev> DataLoad(string filepath)
        {
            List <Elev>  students = new List <Elev>();
            StreamReader sr       = sr = new StreamReader(filepath);
            Elev         elev     = new Elev();

            string line = sr.ReadLine();

            while (line != null)
            {
                string[] datas  = line.Split(',');
                string[] grades = datas[3].Split(' ');
                elev = new Elev(datas[0], datas[1], datas[2], grades);
                students.Add(elev);
                line = sr.ReadLine();
            }

            return(students);
        }