Example #1
0
        static void Main(string[] args)
        {
            Diary D1 = new Diary();

            D1.dodawanie(5);
            D1.dodawanie(8.5f);
            D1.dodawanie(4.7f);

            DiaryStat stats = D1.ComputeStat();

            Console.WriteLine("Srednia ocen to: " + stats.avg);
            Console.WriteLine("Max ocena to: " + stats.maxoc);
            Console.WriteLine("Min ocena to: " + stats.minoc);



            Diary D2 = new Diary();

            D2.dodawanie(2);
            D2.dodawanie(1.5f);
            D2.dodawanie(4.75f);

            stats = D2.ComputeStat();

            Console.WriteLine("Srednia ocen to: " + stats.avg);
            Console.WriteLine("Max ocena to: " + stats.maxoc);
            Console.WriteLine("Min ocena to: " + stats.minoc);

            Console.ReadKey();
        }
Example #2
0
        internal DiaryStat ComputeStat()
        {
            DiaryStat stats = new DiaryStat();

            float suma = 0f;

            foreach (var ocena in oceny)
            {
                suma += ocena;
            }

            stats.avg   = suma / oceny.Count();
            stats.maxoc = oceny.Max();
            stats.minoc = oceny.Min();

            return(stats);
        }