Exemplo n.º 1
0
        public override statistics GetStatistics()
        {
            var result = new statistics();

            for (var index = 0; index < grades.Count; index++)
            {
                result.Add(grades[index]);
            }

            return(result);
        }
Exemplo n.º 2
0
        public override statistics GetStatistics()
        {
            var result = new statistics();

            using (var reader = File.OpenText($"{Name}.txt"))
            {
                var line = reader.ReadLine();
                while (line != null)
                {
                    var number = double.Parse(line);
                    result.Add(number);
                    line = reader.ReadLine();
                }
            }

            return(result);
        }
Exemplo n.º 3
0
      internal statistics GetStatistics()
      {
          var result    = new statistics();
          var highgrade = double.MinValue;
          var lowgrade  = double.MaxValue;

          foreach (var number in grades)
          {
              lowgrade  = Math.Min(number, lowgrade);
              highgrade = Math.Max(number, highgrade);
              result   += number;
          }
          result /= grades.Count;
          Console.WriteLine($"The lowest grade is {lowgrade} ");
          Console.WriteLine($"The high grade is {highgrade}");
          Console.WriteLine($"the Average grade is {result}");
      }