Пример #1
0
        public override statistics GetStatistics()
        {
            var result = new statistics();

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

            return(result);
        }
Пример #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);
        }
Пример #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}");
      }