Ejemplo n.º 1
0
        public DiaryStatistics Computerstatistics()
        {
            DiaryStatistics stats = new DiaryStatistics();

            float sum = 0f;

            foreach (var rating in ratings)
            {
                sum = sum + rating;
            }

            stats.AverageGrade = sum / ratings.Count();
            stats.MaxGrade     = ratings.Max();
            stats.MinGrade     = ratings.Min();

            return(stats);
        }
Ejemplo n.º 2
0
        static void Main(string[] args)
        {
            Diary diary = new Diary();

            diary.AddRating(3f);
            diary.AddRating(5f);
            diary.AddRating(8.4f);

            Console.WriteLine(Diary.MaxGrade);

            Diary diary2 = new Diary();
            Diary diary3 = new Diary();
            Diary diary4 = new Diary();
            Diary diary5 = new Diary();
            Diary diary6 = new Diary();

            Console.WriteLine(Diary.Count);


            DiaryStatistics stats = diary.Computerstatistics();
        }