Ejemplo n.º 1
0
        static void Main(string[] args)
        {
            Person person1 = new Person("Adam", "Miś", new DateTime(1990, 3, 20, 12, 30, 10));
            Person person2 = new Student("Michał", "Kot", new DateTime(1990, 4, 13), 3, 5, 12345);
            Person person3 = new FootballPlayer("Mateusz", "Żbik", new DateTime(1986, 8, 10), "striker", "FC Barcelona", 10);

            person1.Details();
            person2.Details();
            person3.Details();
            Student student = new Student("Micha", "Kt", new DateTime(1990, 4, 13), 3, 5, 12345);

            student.Details();
            ((Player)person3).ScoreGoal();
            person3.Details();

            ((Student)person2).AddGrade("PO", 5.0D, new DateTime(2011, 2, 20));
            ((Student)person2).AddGrade("Bazy Danych", 5.0D, new DateTime(2011, 2, 13));
            person2.Details();

            Grade grade = new Grade("Bazy Danych", 5.0D, new DateTime(2011, 5, 1));

            student.AddGrade(grade);
            student.AddGrade("AWWW", 5.0D, new DateTime(2011, 5, 11));
            student.AddGrade("AWWW", 4.5D, new DateTime(2011, 4, 2));
            student.Details();
            student.DeleteGrade("AWWW", 4.5D, new DateTime(2011, 4, 2));
            student.Details();
            student.DeleteGrades("AWWW");
            student.Details();
            student.AddGrade("AWWW", 5.0D, new DateTime(2011, 4, 3));
            student.DeleteGrades();
            student.Details();

            Player footballer = new HandballPlayer("Piotr", "Kos", new DateTime(1984, 9, 14), "striker", "FC Politechnika");

            footballer.Details();

            footballer.ScoreGoal();
            footballer.ScoreGoal();

            footballer.Details();

            Console.ReadKey();
        }
Ejemplo n.º 2
0
        static void Main(string[] args)
        {
            Person o  = new Person("Adak", "Adacki", "20.03.1980");
            Person o2 = new Student("Babak", "Babacki", "13.04.1990", 2, 1, 12345);
            Person o3 = new Footballer("Cabak", "Cabacki", "10.08.1986", "defence", "FC Barcelona");

            Console.WriteLine(o.ToString());
            Console.WriteLine(o2.ToString());
            Console.WriteLine(o3.ToString());

            Student    stu = new Student("Dabak", "Dabacki", "22.12.1990", 2, 5, 54321);
            Footballer soc = new Footballer("Ebak", "Ebacki", "14.09.1984", "attack", "Chelsea");

            Console.WriteLine(stu.ToString());
            Console.WriteLine(soc.ToString());

            ((Footballer)o3).ScoreAGoal();
            soc.ScoreAGoal();
            soc.ScoreAGoal();

            FootballPlayer f1 = new FootballPlayer("Fabak", "Fabacki", "14.09.1984", "attack", "Chelsea");

            f1.ScoreAGoal();

            Console.WriteLine(f1.ToString());

            HandballPlayer h1 = new HandballPlayer("Gabak", "Gabacki", "05.05.2020", "Defence", "HanPlay");

            h1.ScoreAGoal();

            Console.WriteLine(h1.ToString());
            Console.WriteLine(o3.ToString());
            Console.WriteLine(soc.ToString());

            Console.WriteLine("-----------------------------------");

            ((Student)o2).AddRate("PO", "14.03.2020", 5.0);
            ((Student)o2).AddRate("Databases", "14.03.2020", 4.0);

            Console.WriteLine(o2.ToString());

            stu.AddRate("Databases", "01.05.2019", 5.0);
            stu.AddRate("Computer Science", "13.03.2020", 5.5);
            stu.AddRate("Computer technology", "15.03.2020", 3.5);
            Console.WriteLine("---------------Powinny być 3 oceny -------------");

            Console.WriteLine(stu.ToString());

            Console.WriteLine("---------------Powinny być 2 oceny -------------");

            stu.DeleteRate("Computer technology", "15.03.2020", 3.5);

            Console.WriteLine(stu.ToString());

            stu.AddRate("AWW", "02.04.2011", 4.5);
            stu.DeleteAllRates();

            Console.WriteLine("---------------Powinny być 0 oceny -------------");

            Console.WriteLine(stu.ToString());


            Console.ReadKey();
        }