Exemplo n.º 1
0
        public static Student findStudentWithMinMark(Brigade brigade)
        {
            if (brigade == null)
            {
                return(null);
            }

            Student[] equipment = brigade.getStudents();

            if (equipment == null || equipment.Length == 0)
            {
                return(null);
            }

            Student minPowerEquipment = equipment[0];

            foreach (Student anEquipment in equipment)
            {
                if (minPowerEquipment.getMark() > anEquipment.getMark())
                {
                    minPowerEquipment = anEquipment;
                }
            }
            return(minPowerEquipment);
        }
Exemplo n.º 2
0
        public static double calcAverageMark(Brigade brigade)
        {
            if (brigade == null)
            {
                return(0.0);
            }

            Student[] students = brigade.getStudents();
            double    sumMark  = 0.0;

            if (students == null || students.Length == 0)
            {
                return(sumMark);
            }


            foreach (Student student in students)
            {
                sumMark += student.getMark();
            }

            return(sumMark / students.Length);
        }