Esempio n. 1
0
        static void Main()
        {
            OnsiteStudent   onsiteStudent        = new OnsiteStudent("Ivan", "Petkanov", 23, 4312, 4.6, "Mathematics", 4);
            OnlineStudent   onlineStudent        = new OnlineStudent("Nikolay", "Bardarov", 30, 1231, 5.7, "Informatics");
            GraduateStudent graduateStudent      = new GraduateStudent("Vlado", "Stanoev", 35, 82321, 4.1);
            DropoutStudent  dropoutStudent       = new DropoutStudent("Venci", "Topalov", 27, 24213, 3.4, "Too dumb to exist.");
            OnlineStudent   anotherOnlineStudent = new OnlineStudent("Mitko", "Vasilev", 19, 24231, 5, "OOP");
            OnsiteStudent   anotherOnsiteStudent = new OnsiteStudent("Toshe", "Pavlov", 28, 24341, 4.5, "JavaScript", 19);
            SeniorTrainer   seniorTrainer        = new SeniorTrainer("Svetlin", "Nakov", 35);
            JuniorTrainer   juniorTrainer        = new JuniorTrainer("Iordan", "Darakchiev", 24);

            List <Person> listOfPersons = new List <Person>()
            {
                onsiteStudent,
                onlineStudent,
                graduateStudent,
                dropoutStudent,
                anotherOnlineStudent,
                anotherOnsiteStudent,
                seniorTrainer,
                juniorTrainer
            };

            var sortedCurrentStudents = listOfPersons
                                        .Where(p => p is CurrentStudent)
                                        .Cast <CurrentStudent>()
                                        .OrderBy(cs => cs.AverageGrade);

            foreach (var currentStudent in sortedCurrentStudents)
            {
                Console.WriteLine(currentStudent);
            }
        }
Esempio n. 2
0
        static void Main(string[] args)
        {
            JuniorTrainer gosho = new JuniorTrainer("gosho", "goshev", 23);

            gosho.CreateCourse("C#");
            SeniorTrainer pesho = new SeniorTrainer("pesho", "peshev", 23);

            pesho.CreateCourse("OOP");
            pesho.DeleteCourse("OOP");
            DropoutStudent sashka = new DropoutStudent("sashka", "vaseva", 55, 1234567890, 5.65, "I do not know...");

            sashka.Reapply();
            OnsideStudent tasho  = new OnsideStudent("tasho", "tashev", 19, 1234567890, 5.00, "Java", 13);
            OnlineStudent veso   = new OnlineStudent("vese", "veseloto", 33, 1234567890, 2.20, "JavaScript");
            OnsideStudent ceko   = new OnsideStudent("ceko", "cekov", 19, 1234567890, 4.00, "PHP", 5);
            OnlineStudent stamat = new OnlineStudent("stamat", "stamatov", 33, 1234567890, 5.35, "JavaScript");
            List <Object> people = new List <Object>();

            people.Add(gosho);
            people.Add(pesho);
            people.Add(sashka);
            people.Add(tasho);
            people.Add(veso);
            people.Add(ceko);
            people.Add(stamat);
            people.Where(p => p is CurrentStudent).OrderBy(p => ((CurrentStudent)p).AverageGrade).ToList()
            .ForEach(p => Console.WriteLine(((CurrentStudent)p).FirstName + " " + ((CurrentStudent)p).LastName + " " + ((CurrentStudent)p).AverageGrade));
        }