示例#1
0
        private static void WriteResoults(IGradeTracker caderno)
        {
            Estatistica estatis = caderno.CalcularEstatistica();

            //Console.WriteLine(caderno.Nome);

            WriteResult("Avarage", estatis.AvarageGrade);
            WriteResult("Highest", estatis.HighestGrade);
            WriteResult("Lowest", estatis.LowestGrade);
            WriteResult("Grade", estatis.LetterGrade);
            WriteResult(estatis.Description, estatis.LetterGrade);
            Console.ReadKey();
        }
示例#2
0
        public override Estatistica CalcularEstatistica()
        {
            Console.WriteLine("CadernoNota : ComputeStatistics");

            Estatistica estatis = new Estatistica();

            float sum = 0;

            foreach (float grade in notas)
            {
                estatis.HighestGrade = Math.Max(grade, estatis.HighestGrade);
                estatis.LowestGrade  = Math.Min(grade, estatis.LowestGrade);
                sum = sum + grade; //sum += grade;
            }

            estatis.AvarageGrade = sum / notas.Count;
            return(estatis);
        }