コード例 #1
0
        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);
            }
        }
コード例 #2
0
        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();
            
        }
コード例 #3
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);
            }
        }
コード例 #4
0
ファイル: SULSTest.cs プロジェクト: zhecho1215/HomeWorks
        static void Main(string[] args)
        {
            Student az = new OnlineStudent("Pavel", "Ilchev", 33, 555678, 6.00, "OOP");
            Student ross = new OnlineStudent("Rossen", "Filipov", 30, 435678, 5.80, "OOP");
            Student flik = new OnsiteStudent("Flick", "Flickev", 25, 123678, 5.90, "KPK", 10);
            Student ron = new OnsiteStudent("Rony", "Kouman", 35, 666678, 3.00, "Basic", 1);
            Student dropi = new DropoutStudent("Dropi", "Dropev", 35, 666678, 3.00, "slab uspeh");
            Student outi = new GraduateStudent("Outi", "Outev", 35, 666678, 3.00);

            List<Student> persons = new List<Student>();
            persons.Add(az);
            persons.Add(ross);
            persons.Add(flik);
            persons.Add(ron);
            persons.Add(dropi);
            persons.Add(outi);

            persons.Where(x => x is CurrentStudent).OrderBy(x => x.AverageGrade).ToList().ForEach(y => System.Console.WriteLine(y));
        }
コード例 #5
0
        static void Main(string[] args)
        {
            Student az    = new OnlineStudent("Pavel", "Ilchev", 33, 555678, 6.00, "OOP");
            Student ross  = new OnlineStudent("Rossen", "Filipov", 30, 435678, 5.80, "OOP");
            Student flik  = new OnsiteStudent("Flick", "Flickev", 25, 123678, 5.90, "KPK", 10);
            Student ron   = new OnsiteStudent("Rony", "Kouman", 35, 666678, 3.00, "Basic", 1);
            Student dropi = new DropoutStudent("Dropi", "Dropev", 35, 666678, 3.00, "slab uspeh");
            Student outi  = new GraduateStudent("Outi", "Outev", 35, 666678, 3.00);

            List <Student> persons = new List <Student>();

            persons.Add(az);
            persons.Add(ross);
            persons.Add(flik);
            persons.Add(ron);
            persons.Add(dropi);
            persons.Add(outi);

            persons.Where(x => x is CurrentStudent).OrderBy(x => x.AverageGrade).ToList().ForEach(y => System.Console.WriteLine(y));
        }
コード例 #6
0
ファイル: SULSTest.cs プロジェクト: zlatkovtv/SoftUni_OOP
 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());
     }
 }