static void Main()
        {
            JuniorTrainer   jt1  = new JuniorTrainer("Pesho", "Peshov", 24);
            JuniorTrainer   jt2  = new JuniorTrainer("Gosho", "Goshov", 27);
            JuniorTrainer   jt3  = new JuniorTrainer("Vladko", "Vladkov", 19);
            SeniorTrainer   st1  = new SeniorTrainer("Petko", "Petkov", 33);
            SeniorTrainer   st2  = new SeniorTrainer("Stefan", "Stefanov", 38);
            SeniorTrainer   st3  = new SeniorTrainer("Martin", "Martinov", 29);
            GraduateStudent gt1  = new GraduateStudent("Ivan", "Novakov", 35, 30020925, 4.45);
            GraduateStudent gt2  = new GraduateStudent("Radoslav", "Simeonov", 28, 30058925, 5.80);
            GraduateStudent gt3  = new GraduateStudent("Teodor", "Stoychev", 33, 300521345, 3.00);
            OnlineStudent   ost1 = new OnlineStudent("Emil", "Stefanov", 48, 40018512, 3.33, "OOP");
            OnlineStudent   ost2 = new OnlineStudent("Martin", "Todorov", 22, 40065415, 5.45, "OOP");
            OnlineStudent   ost3 = new OnlineStudent("Valeri", "Zahariev", 18, 40018525, 4.89, "OOP");
            OnsiteStudent   os1  = new OnsiteStudent("Natalya", "Alexandrova", 31, 40089564, 4.00, "OOP", 5);
            OnsiteStudent   os2  = new OnsiteStudent("Adriyana", "Alexandrova", 25, 40012188, 5.25, "OOP", 5);
            OnsiteStudent   os3  = new OnsiteStudent("Peter", "Simeonov", 30, 40035698, 3.80, "OOP", 3);

            List <Person> softuniInvolved = new List <Person>()
            {
                jt1, jt2, jt3, st1, st2, st3, gt1, gt2, gt3, ost1, ost2, ost3, os1, os2, os3
            };

            var currentStudents = softuniInvolved.Where(st => st is CurrentStudent).OrderBy(st => ((Student)st).AverageGrade);

            foreach (var student in currentStudents)
            {
                Console.WriteLine(student);
            }
        }
Exemple #2
0
        static void Main()
        {
            JuniorTrainer fil   = new JuniorTrainer("Filip", "Kolev", 22);
            SeniorTrainer nasko = new SeniorTrainer("Nasko", "Rusenov", 18);

            fil.CraateCourse("C# Advanced");
            nasko.CraateCourse("OOP");

            Student.Student[] students = new Student.Student[]
            {
                new GraduateStudent("Petya", "Petrova", 29, 12003, 5.90),
                new CurrentStudent("Ivan", "Adamov", 24, 71432, 3.54, "OOP"),
                new DropoutStudent("Ivan", "Angelov", 33, 12003, 2.54, "Week results."),
                new CurrentStudent("Georgi", "Popov", 22, 71433, 4.14, "OOP"),
                new DropoutStudent("Angel", "Georgiev", 32, 12006, 4.40, "Discipline problems."),
                new CurrentStudent("Stamat", "Strahilov", 32, 71412, 5.52, "Java Basics"),
                new CurrentStudent("Goran", "Ivanov", 19, 71434, 3.54, "PHP"),
                new CurrentStudent("Ivana", "Lyubenova", 44, 71439, 3.00, "OOP"),
                new OnlineStudent("Zdaravko", "Zdravchev", 22, 12032, 4.80, "OOP"),
                new OnsiteStudent("Lyuba", "Staykova", 45, 32001, 3.55, "JavaScript"),
            };

            Student.Student[] studentsQuery = students
                                              .Where(student => student is CurrentStudent)
                                              .OrderBy(student => student.AverageGrade)
                                              .ToArray();

            Console.WriteLine();
            foreach (Student.Student student in studentsQuery)
            {
                Console.WriteLine(student);
            }
        }
        static void Main()
        {
            JuniorTrainer juniorTrainer1 = new JuniorTrainer("Pesho", "Peshov", 24);
            JuniorTrainer juniorTrainer2 = new JuniorTrainer("GonlineStudentho", "GonlineStudentov", 27);
            JuniorTrainer juniorTrainer3 = new JuniorTrainer("Vladko", "Vladov", 19);
            SeniorTrainer seniorTrainer1 = new SeniorTrainer("Petko", "Petkov", 33);
            SeniorTrainer seniorTrainer2 = new SeniorTrainer("Stefan", "Stefanov", 38);
            SeniorTrainer seniorTrainer3 = new SeniorTrainer("Martin", "Martinov", 29);
            GraduateStudent graduateStudent1 = new GraduateStudent("Ivan", "Novakov", 35, "30020925", 4.45f);
            GraduateStudent graduateStudent2 = new GraduateStudent("RadonlineStudentlav", "Simeonov", 28, "30058925", 5.80f);
            GraduateStudent graduateStudent3 = new GraduateStudent("Teodor", "Stoychev", 33, "300521345", 3.00f);
            DropoutStudent dropoutStudent1 = new DropoutStudent("Nakovalnq", "Nakovalnev", 35, "30020925", 4.45f, "...");
            DropoutStudent dropoutStudent2 = new DropoutStudent("Mmmm", "IdropOut", 28, "30058925", 5.80f, "I dropoutStudentn't care zzzZZZzzz...");
            DropoutStudent dropoutStudent3 = new DropoutStudent("Arnold", "Ill' be back", 33, "300521345", 3.00f, "Terminated!!!");
            OnlineStudent onlineStudent1 = new OnlineStudent("Emil", "Stefanov", 48, "40018512", 3.33f, "OOP");
            OnlineStudent onlineStudent2 = new OnlineStudent("Martin", "Todorov", 22, "40065415", 5.45f, "OOP");
            OnlineStudent onlineStudent3 = new OnlineStudent("Valeri", "Zahariev", 18, "40018525", 4.89f, "OOP");
            OnsiteStudent onsiteStudent1 = new OnsiteStudent("Natalya", "Alexandrova", 31, "40089564", 4.00f, "OOP", 5);
            OnsiteStudent onsiteStudent2 = new OnsiteStudent("Adriyana", "Alexandrova", 25, "40012188", 5.25f, "OOP", 5);
            OnsiteStudent onsiteStudent3 = new OnsiteStudent("Peter", "Simeonov", 30, "40035698", 3.80f, "OOP", 3);

            juniorTrainer1.CreateCourse("Drink brave!");
            seniorTrainer1.CreateCourse("I'm alive!");
            seniorTrainer2.DeleteCourse("Drink brave!");
            dropoutStudent3.Reapply();

            List<Person> softUniPersons = new List<Person>()
            { 
                juniorTrainer1,
                juniorTrainer2,
                juniorTrainer3,
                seniorTrainer1,
                seniorTrainer2,
                seniorTrainer3,
                graduateStudent1,
                graduateStudent2,
                graduateStudent3,
                dropoutStudent1,
                dropoutStudent2,
                dropoutStudent3,
                onsiteStudent1,
                onsiteStudent2,
                onsiteStudent3,
                onlineStudent1,
                onlineStudent2,
                onlineStudent3 
            };

            SULS testSoftUni = new SULS(softUniPersons);
            testSoftUni.ExtractCurrentStudents();
            
        }
Exemple #4
0
        static void Main()
        {
            var nikbank = new JuniorTrainer("Nikolay", "Bankin", "8080808080");
            var vKaranf = new SeniorTrainer("Vlado", "Karnfilov", "7070807070");

            Console.WriteLine(nikbank);
            Console.WriteLine(vKaranf);

            nikbank.CreateCourse("OOP");
            vKaranf.CreateCourse("C# Part:2");
            vKaranf.DeleteCourse("C# Part:2");
            Console.WriteLine(new string('*', Console.WindowWidth));

            var student1 = new GradulateStudent("Gosho", "Loshov", "1234567890", 34, 5.60);
            var student2 = new GradulateStudent("Pesho", "Poshov", "1234567890", 12, 3.60);
            var student3 = new GradulateStudent("Mari", "Markova", "1234567890", 1, 4.20);

            var student13 = new DropoutStudent("Niki", "Nikov", "1234567890", 4, 2.00, "low result");
            var student14 = new DropoutStudent("Mari", "Markova", "1234567890", 1, 4.20, "family reason");

            var student11 = new OnlineStudent("Mitko", "Mitkov", "1234567890", 2, 2.60);
            var student21 = new OnsiteStudent("Goro", "Gororv", "1234567890", 2, 5.66);

            student21.Visits = 23;
            var persons = new HashSet <Person>()
            {
                nikbank,
                vKaranf,
                student1,
                student1,
                student11,
                student13,
                student14,
                student2,
                student3,
                student21
            };

            student11.CurrentCourses.Add("C# Part 1");

            var selectedStudents = from person in persons
                                   where person is CurrentStudent
                                   orderby((Student)person).AverageGrade descending
                                   select person;

            foreach (var student in selectedStudents)
            {
                Console.WriteLine(student);
            }
        }
Exemple #5
0
 public static void Main(string[] args)
 {
     var jTrainer = new JuniorTrainer("Jim", "Parsons", 18);
     var sTrainer = new SeniorTrainer("James", "Yowall", 23);
     var gStudent = new GraduateStudent("Harry", "Fallon", 23, "201255896", 4.99);
     var onlineStudent = new OnlineStudent("Jimmy", "Fallon", 24, "201255896", 4.99, "C#");
     var onsiteStudent = new OnsiteStudent("Ron", "Fallon", 28, "201255896", 4.99, "JAVA", 58);
     var droupoutStudent = new DroupoutStudent("Swan", "Fallon", 21, "201255896", 4.99, "Tries to be funny.");
     var people = new List<Person>();
     people.Add(jTrainer);
     people.Add(sTrainer);
     people.Add(gStudent);
     people.Add(onlineStudent);
     people.Add(onsiteStudent);
     people.Add(droupoutStudent);
     var cStudents = people
         .OfType<CurrentStudent>()
         .OrderBy(y => y.GradeAverage)
         .ToList();
     foreach (var student in cStudents)
     {
         Console.WriteLine(student.ToString());
     }
 }