Beispiel #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);
            }
        }
Beispiel #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));
        }
Beispiel #3
0
        static void Main(string[] args)
        {
            List <Student> students = new List <Student>
            {
                new OnsiteStudent("Pesho", "Geshov", 19, 159232, 5.5, "OOP", 4),
                new DropoutStudent("Toshko", "Toshkov", 21, 123903, 2.2, "Familly reasons"),
                new GraduateStudent("Petko", "Petkov", 22, 652132, 5.6),
                new OnlineStudent("Todor", "Todorov", 25, 652982, 4.5, "Java Basics"),
                new OnsiteStudent("Geco", "Gecov", 35, 123002, 4.3, "OOP", 6),
                new OnsiteStudent("Mitio", "Mitkov", 18, 123123, 5.6, "JS Basics", 5),
                new OnlineStudent("Stefka", "Stefanova", 18, 545432, 5.8, "PHP Basics"),
                new OnsiteStudent("Galq", "Galenova", 20, 321321, 6, "OOP", 6)
            };

            var currentStudents = students
                                  .Where(s => s is CurrentStudent)
                                  .OrderBy(s => s.AverageGrade)
                                  .Select(s => new
            {
                Name          = s.FirstName + " " + s.LastName,
                Age           = s.Age,
                AvgGrade      = s.AverageGrade,
                studentNumber = s.StudentNumber
            });

            foreach (var student in currentStudents)
            {
                Console.WriteLine(student);
            }

            Console.WriteLine();

            var Gancho = new DropoutStudent("Gancho", "Gankov", 22, 123321, 2.2, "Too bad grade");

            Gancho.Reapply();

            Console.WriteLine();

            SeniorTrainer Petkan = new SeniorTrainer("Petkan", "Petkanov", 45);
            JuniorTrainer Goshko = new JuniorTrainer("Goshko", "Goshkov", 33);

            Goshko.CreateCourse("C# Intro");
            Petkan.CreateCourse("C# Basics");
            Petkan.DeleteCourse("C# Intro");
        }
Beispiel #4
0
        static void Main(string[] args)
        {
            List<Student> students = new List<Student>
            {
                new OnsiteStudent("Pesho", "Geshov", 19, 159232, 5.5, "OOP", 4),
                new DropoutStudent("Toshko", "Toshkov", 21,123903, 2.2, "Familly reasons"),
                new GraduateStudent("Petko", "Petkov", 22, 652132, 5.6),
                new OnlineStudent("Todor", "Todorov", 25, 652982, 4.5, "Java Basics"),
                new OnsiteStudent("Geco", "Gecov", 35, 123002, 4.3, "OOP", 6),
                new OnsiteStudent("Mitio", "Mitkov", 18, 123123, 5.6, "JS Basics", 5),
                new OnlineStudent("Stefka", "Stefanova", 18, 545432, 5.8, "PHP Basics"),
                new OnsiteStudent("Galq", "Galenova", 20, 321321, 6, "OOP", 6)
            };

            var currentStudents = students
                .Where(s => s is CurrentStudent)
                .OrderBy(s => s.AverageGrade)
                .Select(s => new
                {
                    Name = s.FirstName + " " + s.LastName,
                    Age = s.Age,
                    AvgGrade = s.AverageGrade,
                    studentNumber = s.StudentNumber
                });

            foreach (var student in currentStudents)
            {
                Console.WriteLine(student);
            }

            Console.WriteLine();

            var Gancho = new DropoutStudent("Gancho", "Gankov", 22, 123321, 2.2, "Too bad grade");
            Gancho.Reapply();

            Console.WriteLine();

            SeniorTrainer Petkan = new SeniorTrainer("Petkan", "Petkanov", 45);
            JuniorTrainer Goshko = new JuniorTrainer("Goshko", "Goshkov", 33);

            Goshko.CreateCourse("C# Intro");
            Petkan.CreateCourse("C# Basics");
            Petkan.DeleteCourse("C# Intro");
        }