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

            diary.AddRating(5);
            diary.AddRating(8.5f);
            diary.AddRating(4.7f);
            diary.AddRating(1.2f);
            diary.AddRating(3.5f);

            DiaryStatistics stats = diary.ComputeStatistics();

            Console.WriteLine("Srednia ocena: " + stats.AverageGrade);
            Console.WriteLine("Maksymalna ocena: " + stats.MaxGrade);
            Console.WriteLine("Minimalna ocena: " + stats.MinGrade);

            Diary diary2 = new Diary();

            diary2.AddRating(5);
            diary2.AddRating(2);
            diary2.AddRating(6);
            diary2.AddRating(8);
            diary2.AddRating(9);

            stats = diary2.ComputeStatistics();

            Console.WriteLine("Srednia ocena: " + stats.AverageGrade);
            Console.WriteLine("Maksymalna ocena: " + stats.MaxGrade);
            Console.WriteLine("Minimalna ocena: " + stats.MinGrade);

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

            diary.AddRating(5);
            diary.AddRating(8.5f);
            diary.AddRating(4.7f);



            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.MaxGrade);

            Console.WriteLine(Diary.Count);

            Console.WriteLine(diary3.Count2);
            Console.WriteLine(diary6.Count2);
            DiaryStatistics stats = diary.ComputeStatistics();

            Console.ReadKey();
        }
Ejemplo n.º 3
0
        static void Main(string[] args)
        {
            Diary diary = new Diary();

            diary.AddRating(5);
            diary.AddRating(8.5f);
            diary.AddRating(4.7f);

            DiaryStatistics stats = diary.ComputeStatistics();

            Console.WriteLine("Średnia wartośc: " + stats.AverageGrade);
            Console.WriteLine("Max wartośc: " + stats.MaxGrade);
            Console.WriteLine("Min wartośc: " + stats.MinGrade);


            Diary diary2 = new Diary();

            diary2.AddRating(5);
            diary2.AddRating(8.5f);
            diary2.AddRating(4.7f);
            diary2.AddRating(9.7f);

            stats = diary2.ComputeStatistics();

            Console.WriteLine("Średnia wartośc: " + stats.AverageGrade);
            Console.WriteLine("Max wartośc: " + stats.MaxGrade);
            Console.WriteLine("Min wartośc: " + stats.MinGrade);

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

            Console.WriteLine(Diary.Count);
        }
Ejemplo n.º 4
0
        static void Main(string[] args)
        {
            Diary diary = new Diary();

            diary.AddRating(5);
            diary.AddRating(3.5f);
            diary.AddRating(1.5f);

            DiaryStatistics stats = diary.ComputeStatistics();


            //float avg = diary.CalculateAverage();
            //float min = diary.GiveMinRating();
            //float max = diary.GiveMaxRating();

            //for ( ; ; )
            //{
            //    Console.WriteLine("Podaj ocenę w zakresie 1 - 10");
            //    float rating;
            //    bool result = float.TryParse(Console.ReadLine(), out rating);



            //    if (rating == 11)
            //    {
            //        break;
            //    }

            //    if (result == true)
            //    {
            //        if (rating > 0 && rating <= 10)
            //        {
            //            diary.AddRating(rating);
            //        }
            //        else
            //        {
            //            Console.WriteLine("Niepoprawna ocena !");
            //        }

            //    }
            //}
            //Console.WriteLine("Średnia ocena to : " + diary.CalculateAverage());
            //Console.WriteLine("Najwyższa ocena to : " + diary.GiveMaxRating());
            //Console.WriteLine("Najniższa ocena to : " + diary.GiveMinRating());
            //Console.ReadKey();
        }
Ejemplo n.º 5
0
        static void Main(string[] args)
        {
            Diary[] Uczniowie = new Diary[2];
            for (int i = 0; i < 2; i++)
            {
                Console.WriteLine("Wprowadz oceny ucznia nr " + (i + 1));
                Diary diary = new Diary();
                //diary.AddRating(5);
                //diary.AddRating(4.5f);
                //diary.AddRating(4.8f);
                //diary.AddRating(2.5f);

                diary.AddRating();

                //Console.WriteLine("Srednia twoich ocen = " + diary.CalculateAverage());
                //Console.WriteLine("Najlepsza twoja ocena to " + diary.MaxRating());
                //Console.WriteLine("Najgorsza twoja ocena to " + diary.MinRating());

                DiaryStatistics diaryStatistics = diary.ComputeStatistics();
                Console.WriteLine("Srednia twoich ocen = " + diaryStatistics.AverageGrade);
                Console.WriteLine("Najlepsza twoja ocena to " + diaryStatistics.MaxGrade);
                Console.WriteLine("Najgorsza twoja ocena to " + diaryStatistics.MiniGrade);
                Swiadectwo.Sprawdzenie((int)diaryStatistics.AverageGrade);

                //Console.WriteLine();
                //Console.WriteLine("Wprowadz oceny ucznia nr 2.");
                //Diary diary2 = new Diary();
                //diary2.AddRating();

                //diaryStatistics = diary2.ComputeStatistics();
                //Console.WriteLine("Srednia twoich ocen = " + diaryStatistics.AverageGrade);
                //Console.WriteLine("Najlepsza twoja ocena to " + diaryStatistics.MaxGrade);
                //Console.WriteLine("Najgorsza twoja ocena to " + diaryStatistics.MiniGrade);
            }

            Console.WriteLine(Diary.count);

            Console.ReadKey();
        }
Ejemplo n.º 6
0
        static void Main(string[] args)
        {
            Diary diary = new Diary();

            diary.AddRating(5);
            diary.AddRating(8.5f);
            diary.AddRating(4.7f);
            diary.AddRating(1.2f);
            diary.AddRating(9.6f);

            DiaryStatistics stats = diary.ComputeStatistics();

            Console.WriteLine("Srednia ocena: " + stats.AverageGrade);
            Console.WriteLine("Maksymakna ocena: " + stats.MaxGrade);
            Console.WriteLine("Minimalna ocena: " + stats.MinGrade);

            Diary diary2 = new Diary();

            diary2.AddRating(5);
            diary2.AddRating(2.5f);
            diary2.AddRating(3.7f);
            diary2.AddRating(4.2f);
            diary2.AddRating(7.6f);

            stats = diary2.ComputeStatistics();


            Console.WriteLine("Srednia ocena: " + stats.AverageGrade);
            Console.WriteLine("Maksymakna ocena: " + stats.MaxGrade);
            Console.WriteLine("Minimalna ocena: " + stats.MinGrade);

            //SpeechSynthesizer synt = new SpeechSynthesizer();
            //synt.Speak("Cześć Marcin");

            //Console.ReadKey();
        }
Ejemplo n.º 7
0
        static void Main(string[] args)
        {
            Diary diary = new Diary();

            diary.AddRating(5);
            diary.AddRating(8.5f);
            diary.AddRating(4.7f);
            diary.AddRating(1.2f);
            diary.AddRating(11.6f); // nie mieści się w zakresie i nie zostanie dodana przez metode


            DiaryStatistics stats = diary.ComputeStatistics();

            Console.WriteLine("Średnia ocena: " + stats.AverageGrade);
            Console.WriteLine("Maksymalna ocena: " + stats.MaxGrade);
            Console.WriteLine("Minimalna ocena: " + stats.MinGrade);

            Console.WriteLine("maxgrade=" + Diary.MaxGrade);
            Console.WriteLine("mingrade=" + Diary.MinGrade);

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

            Console.WriteLine("liczba dzienniczków: " + Diary.Count);
            Console.WriteLine("count2 dzienniczka : " + diary.Count2);

            SpeechSynthesizer synth = new SpeechSynthesizer();

            synth.Speak("liczba dzienniczków: " + Diary.Count);



            //Diary diary2 = new Diary();
            //diary2.AddRating(5);
            //diary2.AddRating(2.5f);
            //diary2.AddRating(3.7f);
            //diary2.AddRating(4.2f);
            //diary2.AddRating(7.6f);

            //stats = diary2.ComputeStatistics();

            //Console.WriteLine("Średnia ocena: " + stats.AverageGrade);
            //Console.WriteLine("Maksymalna ocena: " + stats.MaxGrade);
            //Console.WriteLine("Minimalna ocena: " + stats.MinGrade);



            //float avg = diary.CalculateAverage();
            //float max = diary.GiveMaxRating();
            //float min = diary.GiveMinRating();

            //for (;; )
            //{
            //    Console.WriteLine("Podaj ocenę z zakresu 1-10");

            //    float rating;
            //    bool result = float.TryParse(Console.ReadLine(),out rating);


            //    if (rating == 11)
            //    {
            //        break;
            //    }
            //    if (result == true)  // zapis skrócony "if (result)"  domyślnie przyrównuje do true
            //    {
            //        if (rating > 0 && rating <=10)
            //        {
            //            diary.AddRating(rating);
            //        }
            //        else
            //        {
            //            Console.WriteLine("niepoprawna liczba. Podaj liczbe z zakresu 1-10");
            //        }

            //    }



            //}
            //Console.WriteLine("Średnia twoich ocen to : " + diary.CalculateAverage());
            //Console.WriteLine("Najwyższa ocena to : " + diary.GiveMaxRating());
            //Console.WriteLine("Najniższa ocena to : " + diary.GiveMinRating());
            //Console.ReadKey();

            //Diary diary2 = new Diary();
            //Diary diary3 = new Diary();
            //Diary diary4 = new Diary();
            //Diary diary5 = new Diary();
            Console.ReadKey();
        }
Ejemplo n.º 8
0
        static void Main(string[] args)
        {
            Diary diary = new Diary();

            diary.AddRating(5);
            diary.AddRating(8.5f);
            diary.AddRating(4.7f);
            diary.AddRating(1.2f);
            diary.AddRating(9.6f);

            DiaryStatistics stats = diary.ComputeStatistics();

            Console.WriteLine("Średnia ocena: " + stats.AverageGrade);
            Console.WriteLine("Maksymalna ocena: " + stats.MaxGrade);
            Console.WriteLine("Minimalna ocena: " + stats.MinGrade);

            Console.WriteLine();
            Diary diary2 = new Diary();

            diary2.AddRating(5);
            diary2.AddRating(2.5f);
            diary2.AddRating(3.7f);
            diary2.AddRating(4.2f);
            diary2.AddRating(7.6f);

            stats = diary2.ComputeStatistics();

            Console.WriteLine("Średnia ocena: " + stats.AverageGrade);
            Console.WriteLine("Maksymalna ocena: " + stats.MaxGrade);
            Console.WriteLine("Minimalna ocena: " + stats.MinGrade);
            //float avg = diary.CalculateAverage();
            //float max = diary.GiveMaxRating();
            //float min = diary.GiveMinRating();

            //for (; ; )
            //{
            //    Console.WriteLine("Podaj ocenę z zakresu: 1 - 10 (liczba 11 kończy wprowadzanie danych).");

            //    float rating;
            //    bool result = float.TryParse(Console.ReadLine(), out rating);

            //    if (rating == 11)
            //    {
            //        break;
            //    }

            //    if (result)
            //    {
            //        if (rating > 0 && rating <= 10 )
            //        {
            //            diary.AddRating(rating);
            //        }
            //        else
            //        {
            //            Console.WriteLine("Niepoprawna liczba, podaj liczbę z zakresu: 1 - 10.");
            //        }
            //    }
            //}

            //Console.WriteLine("Średnia twoich ocen to: " + diary.CalculateAverage());
            //Console.WriteLine("Najwyższa ocena to: " + diary.GiveMaxRating());
            //Console.WriteLine("Najniższa ocena to: " + diary.GiveMinRating());

            //Console.ReadKey();
        }
Ejemplo n.º 9
0
        //static void GiveName(ref Diary diary)
        //{
        //    diary = new Diary();
        //    diary.Name = "Nowy Dzienniczek Marcina";
        //}

        //static int IncrementNumber(int number)
        //{
        //    number = 42;
        //    return number;
        //}
        static void Main(string[] args)
        //{
        //    //PassByValueAndRef();

        //    // Immutable();
        //    Arrays();
        //}

        //private static void Arrays()
        //{
        //    float[] ratings;
        //    ratings = new float[5];

        //    AddRatings(ratings);


        //    foreach (var rating in ratings)
        //    {
        //        Console.WriteLine(rating);
        //    }
        //}

        //private static void AddRatings(float[] ratings)
        //{
        //    if (ratings.Length >= 4)
        //    {
        //        ratings[0] = 4.2f;
        //        ratings[1] = 6.7f;
        //        ratings[2] = 3f;
        //        ratings[3] = 8.5f;
        //        ratings[4] = 4.4f;
        //    }
        //}

        //private static void Immutable()
        //{
        //    string name = "   Marcin    ";
        //    name = name.Trim();
        //    Console.WriteLine(name);

        //    DateTime date = new DateTime(2015, 3, 10);
        //    date = date.AddHours(48);
        //    Console.WriteLine(date);
        //}


        //string name1 = "  Marcin  ";
        //string name2 = "marcin";

        //bool areEqual = name1.Equals(name2, StringComparison.CurrentCultureIgnoreCase);
        //Console.WriteLine(areEqual);
        {
            Diary diary = new Diary();

            diary.AddRating(5);
            diary.AddRating(8.5f);
            diary.AddRating(4.7f);
            diary.AddRating(1.2f);
            diary.AddRating(9.6f);

            //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.ComputeStatistics();

            Console.WriteLine("Średnia Twoich ocen to: " + stats.AverageGrade);
            Console.WriteLine("Najwyższa ocena to: " + stats.MaxGrade);
            Console.WriteLine("Najniższa ocena to: " + stats.MinGrade);
            Console.ReadKey();

            Diary diary2 = new Diary();

            diary2.AddRating(5);
            diary2.AddRating(2.5f);
            diary2.AddRating(3.7f);
            diary2.AddRating(4.2f);
            diary2.AddRating(7.6f);

            stats = diary2.ComputeStatistics();

            Console.WriteLine("Średnia Twoich ocen to: " + stats.AverageGrade);
            Console.WriteLine("Najwyższa ocena to: " + stats.MaxGrade);
            Console.WriteLine("Najniższa ocena to: " + stats.MinGrade);
            Console.ReadKey();

            SpeechSynthesizer synt = new SpeechSynthesizer();

            synt.Speak("Cześć Beatka. Jak się czujesz?. Czego tu");

            //float avg = diary.CalculateAverage();
            //float max = diary.GiveMaxRating();
            //float min = diary.GiveMinRating();
        }
Ejemplo n.º 10
0
        static void Main(string[] args)
        {
            Diary diary = new Diary();

            diary.AddRating(5);
            diary.AddRating(8.5f);
            diary.AddRating(4.7f);
            diary.AddRating(1);
            diary.AddRating(2.5f);
            diary.AddRating(7.3f);
            //float avg = diary.CalculateAverage();
            //float max = diary.GiveMaxRating();
            //float min = diary.GiveMinRating();

            DiaryStatistics stats = diary.ComputeStatistics();


            Console.WriteLine("Średnia ocena: " + stats.averageGrade);
            Console.WriteLine("Maksymalna ocena: " + stats.maxGrade);
            Console.WriteLine("Minimalna ocena: " + stats.minGrade);

            Diary diary2 = new Diary();

            diary2.AddRating(4);
            diary2.AddRating(7.5f);
            diary2.AddRating(5.7f);
            diary2.AddRating(2);
            diary2.AddRating(1.5f);
            diary2.AddRating(8.3f);

            stats = diary2.ComputeStatistics();

            Console.WriteLine("Średnia ocena: " + stats.averageGrade);
            Console.WriteLine("Maksymalna ocena: " + stats.maxGrade);
            Console.WriteLine("Minimalna ocena: " + stats.minGrade);


            //for (; ;)
            //{
            //    Console.WriteLine("Podaj ocenę z zakresu 1.0 - 10.0");

            //    float rating;
            //    bool result = float.TryParse(Console.ReadLine(), out rating);

            //    if (rating == 11)
            //    {
            //        break;
            //    }

            //    if (result)         //To samo co: if (result == true)
            //    {
            //        if (rating >= 0 && rating <= 10)
            //        {
            //            diary.AddRating(rating);
            //        }
            //        else
            //        {
            //            Console.WriteLine("Liczba poza zakresem.");
            //        }
            //    }
            //}

            //Console.WriteLine("Średnia twoich ocen to: " + diary.CalculateAverage());
            //Console.WriteLine("Najwyższa ocena to: " + diary.GiveMaxRating());
            //Console.WriteLine("Najniższa ocena to: " + diary.GiveMinRating());
            //Console.ReadKey();
        }