public override GradeStatistics ComputeStatistics()
        {
            GradeStatistics          stats = new GradeStatistics();
            AlphabeticalGradingStats it    = new AlphabeticalGradingStats();
            double sum1 = 0;

            foreach (double grade in grades)
            {
                sum1 = sum1 + grade;
                stats.HighestGrade = Math.Max(grade, stats.HighestGrade);
                stats.LowestGrade  = Math.Min(grade, stats.LowestGrade);
            }
            var countoffailures = 0;

            stats.Aggregate    = sum1;
            stats.AverageGrade = sum1 / grades.Count;
            for (int i = 0; i < grades.Count(); i++)
            {
                if (grades[i] <= stats.FailureGrade)
                {
                    countoffailures++;
                    continue;
                }
            }
            if (countoffailures <= 0)
            {
                Console.WriteLine("Great ,you have not failed in any of the subjects");
            }
            else
            {
                Console.WriteLine($"You have failed in {countoffailures} subjects as the marks are less than 35");
            }

            return(stats);
        }
Ejemplo n.º 2
0
        public AlphabeticalGradingStats ComputeAlphabeticalGrades(GradeStatistics gradesOfStudents)
        {
            var alphagrading = new AlphabeticalGradingStats();


            if (gradesOfStudents.HighestGrade > 90)
            {
                Console.WriteLine("The grade for the highestgrader student is :{0}", alphagrading.APlusGrade);
            }
            else if (gradesOfStudents.LowestGrade < 50)
            {
                Console.WriteLine("The grade for the lowestgrader student is :{0}", alphagrading.CGrade);
            }

            return(alphagrading);
        }