Example #1
0
        public static void Main()
        {
            List<Student> students = new List<Student>
            {
                new OnsiteStudent("Peter", "Petrov", 25, "000001", 3.4m, "OOP"),
                new OnsiteStudent("Anna", "Kirova", 27, "000002", 5.8m, "OOP"),
                new OnlineStudent("Kiril", "Hristov", 30, "000006", 4.65m, "OOP"),
                new GraduateStudent("Ivan", "Ivanov", 29, "000005", 5.17m),
                new DropoutStudent("Ceco", "Avramov", 22, "000015", "Playing CounterStrike during lectures", 2.89m)
            };

            //sorting current students by average grade
            var currentStudents = students
                                    .Where(st => st is CurrentStudent)
                                    .OrderBy(st => st.AverageGrade)
                                    .Select(st => new
                                        {
                                            Name = st.FirstName + " " + st.LastName,
                                            Age = st.Age,
                                            ID = st.StudentNumber,
                                            AvrGrade = st.AverageGrade
                                        });

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

            Console.WriteLine();

            //printing the Reapply() method of a dropout student
            DropoutStudent ceco = new DropoutStudent("Ceco", "Avramov", 22, "000015", "Playing CounterStrike during lectures", 2.89m);
            ceco.Reapply();

            Console.WriteLine();

            //adding and deleting courses for junior and senior trainers
            JuniorTrainer acho = new JuniorTrainer("Angel", "Georgiev", 28);
            SeniorTrainer nakov = new SeniorTrainer("Svetlin", "Nakov", 35);

            acho.CreateCourse("JS Apps");
            acho.CreateCourse("Java Basics");
            Console.WriteLine("Courses that Angel is training: " + String.Join(", ", acho.Courses) + "\n");

            nakov.CreateCourse("OOP");
            nakov.CreateCourse("Advanced Java");
            Console.WriteLine("Courses that Nakov is training: " + String.Join(", ", nakov.Courses) + "\n");
            nakov.DeleteCourse("OOP");
            Console.WriteLine("Courses that Nakov is training: " + String.Join(", ", nakov.Courses));
        }
Example #2
0
        static void Main(string[] args)
        {
            Trainer nakov = new SeniorTrainer("Svetlin", "Nakov");
            Trainer georgiev = new JuniorTrainer("Vladislav", "Georgiev", 20);

            CurrentStudent pesho = new OnlineStudent("Pesho", "Peshev", "215864", (double)4.256, 20);
            CurrentStudent gosho = new OnsiteStudent("Gosho", "Goshev", "356984", (double)5.897, 21, 15);
            CurrentStudent tedi = new OnsiteStudent("Teodora", "Andreeva", "589023", (double)3.587, 19, 8);

            Student minka = new DropoutStudent("Minka", "Mileva", "658974", (double)2.000, "too low grades", 27);
            Student jelqzka = new DropoutStudent("Jelqzka", "Marinkova", "230156", (double)3.958, "moved to another country", 25);
            Student kateto = new GraduateStudent("Katq", "Gancheva", "125896", (double)5.505, 21);
            Student vladko = new GraduateStudent("Vladimir", "Delchev", "125897", (double)4.089, 22);

            List<Person> people = new List<Person>() {nakov, georgiev, pesho, gosho, tedi, minka, jelqzka, kateto, vladko};

            pesho.CurrentCourse.Add("OOP");
            gosho.CurrentCourse.Add("JavaScript Basics");
            tedi.CurrentCourse.Add("C# Basics");

            people.Where(p => p is CurrentStudent).OrderBy(p => ((Student)p).Grades).ToList().ForEach(p => Console.WriteLine(p.ToString()));
        }