Esempio n. 1
0
        internal static void Main()
        {
            //testing SoftUni's learning system
            //testing students
            CurrentStudent crntStudent = new CurrentStudent("Ivan", "Ivanich", 25, 12478, 5.32, "OOP");
            Console.WriteLine(crntStudent);
            Console.WriteLine();
            DropoutStudent drpStudent = new DropoutStudent("Prekusnal", "Student", 21, 12202, 3.03, "Murzi me");
            drpStudent.ReApply();
            Console.WriteLine();
            GraduatedStudent gradStudent = new GraduatedStudent("Evgeni", "Minchev", 35, 22471, 5.92);
            Console.WriteLine(gradStudent);
            Console.WriteLine();

            OnlineStudent onlnStd = new OnlineStudent("Mircho", "Mirchev", 27, 65234, 5.47, "OOP");
            Console.WriteLine(onlnStd);
            Console.WriteLine();
            OnsiteStudent onstStd = new OnsiteStudent("Stef", "Andres", 23, 52416, 4.99, 4, "HQC");
            Console.WriteLine(onstStd);
            Console.WriteLine();

            //testing trainers
            JuniorTrainer jun = new JuniorTrainer("Fil", "Kolev", 32);
            Console.WriteLine(jun);
            jun.CreateCourse("OOP");
            jun.CreateCourse("HQC");
            Console.WriteLine();

            SeniorTrainer sen = new SeniorTrainer("Svetlin", "Nakov", 41);
            Console.WriteLine(sen);
            sen.CreateCourse("Data bases");
            sen.CreateCourse("ASP.Net MCV basics");
            sen.DeleteCourse("OOP");
        }
Esempio n. 2
0
    static void Main()
    {
        Trainer regularTrainer = new Trainer("Gogo", "Strogiya", 60);
        JuniorTrainer juniorTrainer = new JuniorTrainer("Asistent", "Pomagachev", 24);
        SeniorTrainer seniorTrainer = new SeniorTrainer("Golemec", "Shisharkov", 42);
        regularTrainer.CreateCourse("OOP");
        juniorTrainer.CreateCourse("QPC");
        seniorTrainer.CreateCourse("ABC");
        seniorTrainer.DeleteCourse("DEF");
        Console.WriteLine();

        DropoutStudent applicant = new DropoutStudent("Otpadnal", "Student", 21, 1222, 3.03, "Nyama bira!!!");
        applicant.Reapply();
        Console.WriteLine();

        var people = new List<Person>
        {
            new Person("Georgi", "Georgiev", 20),
            new Trainer("Ivan", "Ivanov", 28),
            new JuniorTrainer("Ivan", "Ivanov Jr.", 19),
            new SeniorTrainer("Ivan", "Ivanov Sr.", 35),
            new Student("Pesho", "Peshev", 22, 1234, 5.75),
            new DropoutStudent("Misho", "Mihaylov", 25, 1234, 3.5, "Too few women on campus."),
            new GraduateStudent("Golemets", "Golemiya", 31, 1234, 5.25),
            new CurrentStudent("Stamat", "Botusharov", 23, 1234, 3.25, "OOP"),
            new OnlineStudent("Myrzeliv", "Myrzelivets", 21, 1234, 2.5, "OOP"),
            new OnsiteStudent("Svetlin", "Nakov", 34, 1234, 6, "OOP", 15),
            new CurrentStudent("Irokentij", "Portokalov", 43, 1234, 4.25, "QPC"),
            new OnlineStudent("Onufrij", "Popryckov", 63, 1234, 5.15, "QPC"),
            new OnsiteStudent("Maria", "Ivanova", 19, 1234, 5.86, "QPC", 12)
        };


        //people.Add(new Person("", "Georgiev", 20));
        //people.Add(new Person("Georgi", " ", 10));
        //people.Add(new Person("Georgi", "Georgiev", -2));
        //people.Add(new Person("Georgi", "Georgiev", 101));
        //people.Add(new Student("Pesho", "Peshev", 22, 11, 2.5));
        //people.Add(new Student("Pesho", "Peshev", 22, 1202022, 2.5));
        //people.Add(new Student("Pesho", "Peshev", 22, 1234, 1.9));
        //people.Add(new Student("Pesho", "Peshev", 22, 1234, 7.5));
        //people.Add(new DropoutStudent("Misho", "Mihaylov", 25, 1234, 3.5, ""));
        //people.Add(new CurrentStudent("Stamat", "Botusharov", 23, 1234, 3.25, " "));

        List<CurrentStudent> currentStudents = people.Where(a => a is CurrentStudent).ToList().Cast<CurrentStudent>().ToList();
        var sortedCurrentStudents = currentStudents.OrderBy(a => a.AverageGrade);

        Console.WriteLine("List of current students (sorted by average grade):");
        Console.WriteLine();

        foreach (var student in sortedCurrentStudents)
        {
            Console.WriteLine(student);
        }
    }
Esempio n. 3
0
    public 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.45M);
        GraduateStudent graduateStudent2 = new GraduateStudent("RadonlineStudentlav", "Simeonov", 28, 30058925, 5.80M);
        GraduateStudent graduateStudent3 = new GraduateStudent("Teodor", "Stoychev", 33, 300521345, 3.00M);
        DropoutStudent  dropoutStudent1  = new DropoutStudent("Nakovalnq", "Nakovalnev", 35, 30020925, 4.45M, "...");
        DropoutStudent  dropoutStudent2  = new DropoutStudent("Mmmm", "IdropOut", 28, 30058925, 5.80M, "I dropoutStudentn't care zzzZZZzzz...");
        DropoutStudent  dropoutStudent3  = new DropoutStudent("Arnold", "Ill' be back", 33, 300521345, 3.00M, "Terminated!!!");
        OnlineStudent   onlineStudent1   = new OnlineStudent("Emil", "Stefanov", 48, 40018512, 3.33M, "OOP");
        OnlineStudent   onlineStudent2   = new OnlineStudent("Martin", "Todorov", 22, 40065415, 5.45M, "OOP");
        OnlineStudent   onlineStudent3   = new OnlineStudent("Valeri", "Zahariev", 18, 40018525, 4.89M, "OOP");
        OnsiteStudent   onsiteStudent1   = new OnsiteStudent("Natalya", "Alexandrova", 31, 40089564, 4.00M, "OOP", 5);
        OnsiteStudent   onsiteStudent2   = new OnsiteStudent("Adriyana", "Alexandrova", 25, 40012188, 5.25M, "OOP", 5);
        OnsiteStudent   onsiteStudent3   = new OnsiteStudent("Peter", "Simeonov", 30, 40035698, 3.80M, "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();
    }
Esempio n. 4
0
        static void Main()
        {
            var nasko = new Trainer("Atanas", "Rusenov", 21);
            var fill = new JuniorTrainer("Filip", "Kolev", 28);
            var nakov = new SeniorTrainer("Svetlin", "Nakov", 60);

            var mark = new GraduateStudent("Марк", "Зукърбъргов", 38, 120511, 6.00);
            var mitio = new DropoutStudent("Митьо", "Крика", 40, 343535, 2.30, "Много големи ръки");
            var djordjano = new CurrentStudent("Djordjano", "Djordjankata", 25, 0888155,"Introducing to singing");
            var baiVulcho = new OnlineStudent("Бай", "Вълчо", 73, 4444, 5.60,"OOP");
            var lelqVanche = new OnsiteStudent("Леля", "Ванче", 57, 12034, 4.89, "Аdvanced C#", 20);

            nakov.DeleteCourse("PHP");
            fill.CreateCourse("Advanced C#");
            nasko.CreateCourse("Kopane");
            nakov.DeleteCourse("Kopane"); // Nasko, what are you doing?!?
            Console.WriteLine();

            var persons = new List<Person>()
            {
                nasko,
                fill,
                nakov,
                mark,
                mitio,
                djordjano,
                baiVulcho,
                lelqVanche
            };

            var currentStudents = persons.Where(student => student is CurrentStudent)
                .OrderBy(student => ((Student)student).AverageGrade)
                .Select(student => student);

            foreach (var currentStudent in currentStudents)
            {
                Console.WriteLine(currentStudent);
            }
        }
Esempio n. 5
0
        static void Main()
        {
            var nasko = new Trainer("Atanas", "Rusenov", 21);
            var fill  = new JuniorTrainer("Filip", "Kolev", 28);
            var nakov = new SeniorTrainer("Svetlin", "Nakov", 60);

            var mark       = new GraduateStudent("Марк", "Зукърбъргов", 38, 120511, 6.00);
            var mitio      = new DropoutStudent("Митьо", "Крика", 40, 343535, 2.30, "Много големи ръки");
            var djordjano  = new CurrentStudent("Djordjano", "Djordjankata", 25, 0888155, "Introducing to singing");
            var baiVulcho  = new OnlineStudent("Бай", "Вълчо", 73, 4444, 5.60, "OOP");
            var lelqVanche = new OnsiteStudent("Леля", "Ванче", 57, 12034, 4.89, "Аdvanced C#", 20);

            nakov.DeleteCourse("PHP");
            fill.CreateCourse("Advanced C#");
            nasko.CreateCourse("Kopane");
            nakov.DeleteCourse("Kopane"); // Nasko, what are you doing?!?
            Console.WriteLine();

            var persons = new List <Person>()
            {
                nasko,
                fill,
                nakov,
                mark,
                mitio,
                djordjano,
                baiVulcho,
                lelqVanche
            };

            var currentStudents = persons.Where(student => student is CurrentStudent)
                                  .OrderBy(student => ((Student)student).AverageGrade)
                                  .Select(student => student);

            foreach (var currentStudent in currentStudents)
            {
                Console.WriteLine(currentStudent);
            }
        }
        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);
            }
        }
Esempio n. 7
0
 static void Main()
 {
     List<object> list = new List<object>();
     Person stamat = new Person("Stamat", "Stamtov", 18);
     Trainer vladi = new Trainer("Vladi", "Vargala", 24);
     SeniorTrainer nakov = new SeniorTrainer("Svetin", "Nakov", 22);
     JuniorTrainer niki = new JuniorTrainer("Nikolay", "Bankin", 18);
     niki.CreateCourse("Tvardost na betona");
     nakov.DeleteCourse("Tvardost na betona");
     Student mimi = new Student("Mariya", "Ilieva", 25, 1345, 4.60);
     DropoutStudent vasko = new DropoutStudent("Vasko", "Keca", 17, 300, 5, "Music");
     vasko.Reapply();
     GraduateStudent nobody = new GraduateStudent("Misho", "Birata", 40, 20, 3.40);
     OnlineStudent uncleTony = new OnlineStudent("Uncle", "Antony", 25, 7, 5, "OOP");
     CurrentStudent me = new CurrentStudent("Gosho", "Lyaskov", 28, 1, 5.4, "OOP");
     CurrentStudent you = new CurrentStudent("Pesho", "Peshev", 28, 2, 5.1, "OOP");
     CurrentStudent somebody = new CurrentStudent("Uncnown", "Person", 14, 190, 6, "OOP");
     AddtoList(list, stamat, vladi, nakov, niki, mimi, vasko, nobody, uncleTony, me, you, somebody);
     list.Where(x => x is CurrentStudent).OrderByDescending(x => ((Student)x).StudentAverageGrade).ToList().ForEach(x => Console.WriteLine(x.ToString()));
 }
Esempio n. 8
0
    static void Main(string[] args)
    {
        var juniorTrainer = new JuniorTrainer("Atanas", "Rusenov", 19);
        var seniorTrainer = new SeniorTrainer("Svetlin", "Nakov", 32);
        juniorTrainer.CreateCourse("Teamwork and personal skills");
        seniorTrainer.CreateCourse("Advanced C#");
        seniorTrainer.DeleteCourse("OOP");
        WriteLine();

        // test Reapply() method
        var applicant = new DropoutStudent("Prekusnal", "Student", 21, 1222, 3.03f, "Murzi me");
        applicant.Reapply();
        WriteLine();

        // Create a list of objects from each class
        var people = new List<Person>
            {
                new JuniorTrainer("Geogri", "Paskalev Jr.", 19),
                new SeniorTrainer("Ivan", "Ivanov Sr.", 45),
                new DropoutStudent("Misho", "Mihaylov", 25, 1234, 3.5f, "Mrazim da mislim"),
                new GraduateStudent("Viktor", "Kazakov", 31, 1235, 5.25f),
                new OnlineStudent("Elena", "Trendafilova", 23, 1236, 5.75f, "OOP"),
                new OnlineStudent("Pavleta", "Taseva", 21, 1237, 5.5f, "OOP"),
                new OnsiteStudent("Svetlin", "Nakov", 34, 1238, 6, "OOP", 15),
            };
        
        var sortedCurrentStudents =
            people.Where(a => a is CurrentStudent)
                .Cast<CurrentStudent>()
                .OrderBy(a => a.Grade);
        
        WriteLine("List of current students (sorted by average grade):");
        WriteLine();

        foreach (var student in sortedCurrentStudents)
        {
            WriteLine(student);
        }
    }
Esempio n. 9
0
    static void Main()
    {
        List <Person> softUniPeople  = new List <Person>();
        string        checker        = null;
        uint          studentNumber  = 0u;
        float         averageGrade   = 0f;
        string        currentCourse  = null;
        uint          numberOfVisits = 0u;
        string        dropoutReason  = null;

        do
        {
            Person temp;
            Console.WriteLine("Please choose a type of object:");
            Console.WriteLine("1 - Person");
            Console.WriteLine("2 - Trainer");
            Console.WriteLine("3 - Junior Trainer");
            Console.WriteLine("4 - Senior Trainer");
            Console.WriteLine("5 - Student");
            Console.WriteLine("6 - GraduateStudent");
            Console.WriteLine("7 - CurrentStudent");
            Console.WriteLine("8 - Online Student");
            Console.WriteLine("9 - Onsite Student");
            Console.WriteLine("10 - Dropout Student");
            byte typeOfObject = byte.Parse(Console.ReadLine());
            Console.WriteLine("Please enter a first name:");
            string firstName = Console.ReadLine();
            Console.WriteLine("Please enter a last name:");
            string lastName = Console.ReadLine();
            Console.WriteLine("Please enter an age:");
            int age = int.Parse(Console.ReadLine());
            if (typeOfObject >= 5)
            {
                Console.WriteLine("Please enter a student number:");
                studentNumber = uint.Parse(Console.ReadLine());
                Console.WriteLine("Please enter an average grade:");
                averageGrade = float.Parse(Console.ReadLine());
                if (typeOfObject >= 7 && typeOfObject <= 9)
                {
                    Console.WriteLine("Please enter student current course:");
                    currentCourse = Console.ReadLine();
                    if (typeOfObject == 9)
                    {
                        Console.WriteLine("Please enter a numebr of visits:");
                        numberOfVisits = uint.Parse(Console.ReadLine());
                    }
                }
                else if (typeOfObject == 10)
                {
                    Console.WriteLine("Please enter dropout reason");
                    dropoutReason = Console.ReadLine();
                }
            }
            switch (typeOfObject)
            {
            case (1): temp = new Person(firstName, lastName, age); break;

            case (2): temp = new Trainer(firstName, lastName, age); break;

            case (3): temp = new JuniorTrainer(firstName, lastName, age); break;

            case (4): temp = new SeniorTrainer(firstName, lastName, age); break;

            case (5): temp = new Student(firstName, lastName, age, studentNumber, averageGrade); break;

            case (6): temp = new GraduateStudent(firstName, lastName, age, studentNumber, averageGrade); break;

            case (7): temp = new CurrentStudent(firstName, lastName, age, studentNumber, averageGrade, currentCourse); break;

            case (8): temp = new OnlineStudent(firstName, lastName, age, studentNumber, averageGrade, currentCourse); break;

            case (9): temp = new OnsiteStudent(firstName, lastName, age, studentNumber, averageGrade, currentCourse, numberOfVisits); break;

            case (10): temp = new DropoutStudent(firstName, lastName, age, studentNumber, averageGrade, dropoutReason); break;

            default:
                Console.WriteLine("Invalid object type");
                continue;
            }

            Console.WriteLine("Would you like to print the current object? Y\\N");
            checker = Console.ReadLine();
            if (checker == "Y" || checker == "y")
            {
                Console.WriteLine(temp.ToString());
            }
            if (typeOfObject >= 2 && typeOfObject <= 4)
            {
                Console.WriteLine("Would you like to add a course? Y\\N");
                checker = Console.ReadLine();
                if (checker == "Y" || checker == "y")
                {
                    Console.WriteLine("Please enter a course name:");
                    string  course      = Console.ReadLine();
                    Trainer tempTrainer = (Trainer)temp;
                    tempTrainer.CreateCourse(course);
                }
                if (typeOfObject == 4)
                {
                    Console.WriteLine("Would you like to delete a course? Y\\N");
                    checker = Console.ReadLine();
                    if (checker == "Y" || checker == "y")
                    {
                        Console.WriteLine("Please enter a course name:");
                        string        course      = Console.ReadLine();
                        SeniorTrainer tempTrainer = (SeniorTrainer)temp;
                        tempTrainer.DeleteCourse(course);
                    }
                }
            }
            if (typeOfObject == 10)
            {
                Console.WriteLine("Would you like to reapply? Y\\N");
                checker = Console.ReadLine();
                if (checker == "Y" || checker == "y")
                {
                    DropoutStudent tempStudent = (DropoutStudent)temp;
                    tempStudent.Reapply();
                }
            }
            softUniPeople.Add(temp);
            Console.WriteLine("Would you like to add another object? Y\\N");
            checker = Console.ReadLine();
        } while (checker != "N" && checker != "n");

        softUniPeople.Where(p => p is CurrentStudent).OrderBy(p => ((CurrentStudent)p).AverageGrade).ToList().ForEach(p => Console.WriteLine(p.ToString()));
    }
Esempio n. 10
0
        static void Main()
        {
            DropoutStudent Ivancho = new DropoutStudent("Ivan", "Ivanov", 56, "100323112", 5.6f,
                                                        "Unable to finish OOP course. Failed to show up at the final exam. Personal matters.");

            Ivancho.Reapply();
            Console.WriteLine();
            SeniorTrainer Mite = new SeniorTrainer("Mitko", "Leshtarov", 30, new List <string> {
                "Animation", "Mathematics"
            });

            Mite.CreateCourse("History");
            Mite.DeleteCourse("Animation");
            Mite.PrintOwnCourses();

            List <Person> listOfIndividuals = new List <Person>()
            {
                new JuniorTrainer("Goshko", "Goshkov", 23, new List <string> {
                    "Music", "Mathematics"
                }),
                new JuniorTrainer("Petko", "Nikolov", 19, new List <string> {
                    "OOP", "Drawing"
                }),
                new SeniorTrainer("Mitko", "Leshtarov", 30, new List <string> {
                    "Animation", "Mathematics"
                }),
                new JuniorTrainer("Tonkcho", "Dimitrov", 22, new List <string> {
                    "Biology"
                })
            };

            var rnd = new Random();

            int strNumber  = 123002;
            var firstNames = new List <string>()
            {
                "Goshko", "Petko", "Mitko", "Tonkcho", "Nikola", "Lidia", "Vesela", "Petar", "Mitko", "Pencho",
                "Nikoleta", "Petraki", "Leni", "Vladimir", "Valyo", "Fatim", "Mirela", "Kliment"
            };
            var lastNames = new List <string>()
            {
                "Goshkov/a", "Leshtarov/a", "Dimitrov/a", "Hristov", "Georgiev/a", "Ivanov/a", "Grozdanov/a", "Penchev/a", "Kravitz", "Totev/a", "Fedorov/a"
            };
            var reasons = new List <string>()
            {
                "Myrzel", "Malko po malyk myrzel", "Gadzheto zamina v chujbina", "Propusnat izpit po Java", "Ne si vzeh OOP-to.", "Ivan Ionkov =)"
            };
            var classes = new List <string>()
            {
                "Music", "Mathematics", "OOP", "Drawing", "Animation", "Mathematics", "Biology"
            };

            for (int i = 0; i < rnd.Next(3, 9); i++)
            {
                listOfIndividuals.Add(new GraduateStudent(firstNames[rnd.Next(0, firstNames.Count)], lastNames[rnd.Next(0, lastNames.Count)], rnd.Next(10, 71), (++strNumber).ToString(), (float)(rnd.NextDouble() * (6 - 2) + 2)));
            }

            for (int i = 0; i < rnd.Next(3, 19); i++)
            {
                listOfIndividuals.Add(new DropoutStudent(firstNames[rnd.Next(0, firstNames.Count)], lastNames[rnd.Next(0, lastNames.Count)], rnd.Next(10, 71), (++strNumber).ToString(),
                                                         (float)(rnd.NextDouble() * (6 - 2) + 2), reasons[rnd.Next(0, reasons.Count)]));
            }

            for (int i = 0; i < rnd.Next(2, 7); i++)
            {
                listOfIndividuals.Add(new OnlineStudent(firstNames[rnd.Next(0, firstNames.Count)], lastNames[rnd.Next(0, lastNames.Count)], rnd.Next(10, 71), (++strNumber).ToString(),
                                                        (float)(rnd.NextDouble() * (6 - 2) + 2), classes[rnd.Next(0, classes.Count)]));
            }

            for (int i = 0; i < rnd.Next(2, 7); i++)
            {
                listOfIndividuals.Add(new OnsiteStudent(firstNames[rnd.Next(0, firstNames.Count)], lastNames[rnd.Next(0, lastNames.Count)], rnd.Next(10, 71), (++strNumber).ToString(),
                                                        (float)(rnd.NextDouble() * (6 - 2) + 2), classes[rnd.Next(0, classes.Count)], rnd.Next(0, 255)));
            }

            Console.WriteLine("\nOverall number of individuals in the university: " + Person.NumPersons);
            Console.WriteLine("\nOverall number of active students: " + CurrentStudent.NumCurrentStudents + "\n");

            List <Person> currStudents = listOfIndividuals.Where(x => x is CurrentStudent).
                                         OrderBy(x => (x as CurrentStudent).AvgGrade).ToList();

            currStudents.ForEach(Console.WriteLine);
        }
Esempio n. 11
0
    public static void Main()
    {
        SeniorTrainer nakov = new SeniorTrainer(
            "Svetlin",
            "Nakov",
            22); // forever young :D
        Trainer vGeorgiev = new JuniorTrainer(
            "Vladimir",
            "Georgiev",
            20);

        Student graduated = new GraduateStudent(
            "Ivan",
            "Ivanov",
            25,
            2213435,
            (float)5.60);
        Student dropoutedOne = new DropoutStudent(
            "Vasil",
            "Vasilev",
            21,
            11643,
            (float)2.41,
            "unpaid semester");

        DropoutStudent dropoutedTwo = new DropoutStudent(
            "Nikolay",
            "Nikolov",
            26,
            4566789,
            (float)2.25,
            "bad results");

        Student currentOne = new OnsiteStudent("Petyr", "Petrov", 19, 411313, (float)4.67, "OOP", 2);
        Student currentTwo = new OnlineStudent(
            "Stoyan",
            "Stoyanov",
            32,
            2323439,
            (float)5.19,
            "Java Basics");

        List <Person> persons = new List <Person>()
        {
            nakov, vGeorgiev, graduated, dropoutedOne, dropoutedTwo, currentOne, currentTwo
        };

        Console.WriteLine("Current students:");

        // sort and call ToString method
        persons.Where(p => p is CurrentStudent).OrderBy(p => ((CurrentStudent)p).AverageGrade).ToList().ForEach(p => Console.WriteLine(p.ToString()));

        // create/delete courses
        Console.WriteLine("Created/deleted courses:");
        Console.WriteLine(vGeorgiev.CreateCourse("OPP"));
        Console.WriteLine(nakov.DeleteCourse("Java Basics"));

        Console.WriteLine();

        // reaply students
        Console.WriteLine("Reaply students:");
        Console.WriteLine(dropoutedTwo.Reaplly());
    }