Exemple #1
0
        public static Seminarist[] CreateGroup()
        {
            Console.WriteLine("Enter amount of seminarists: ");

            int amount = Input();

            Seminarist[] group = new Seminarist[amount];

            for (int i = 0; i < amount; i++)
            {
                Console.WriteLine($"Enter info about {(i + 1).ToString()} seminarist:(name, age, sex, amount of marks, VYS, auditoria, patron)");
                group[i] = new Seminarist(Console.ReadLine(), Input(), Console.ReadLine(), Input(), Console.ReadLine(), Input(), Console.ReadLine());
                Console.Clear();
            }

            Console.Clear();

            return(group);
        }
Exemple #2
0
        static void Main(string[] args)
        {
            string messagePS = "\n*Hello, Console!* New seminarist added to the data base.";

            Seminarist ya = new Seminarist("Dima", 17, "male", 10, "MINDA", 55, "St. Dimitriy Prilutskiy");

            ya.Mess += DisplayMessageAdvanced;
            ya.Mess += delegate()
            {
                Console.WriteLine("\n*Hello, Console!* New seminarist added to the data base.");
            };

            ya.Mess += () => Console.WriteLine(messagePS);

            ya.Surname = "Levchuk";
            ya.Adress  = "Brest";
            ya.CURS    = Student.Course.First;

            try
            {
                int x;
                Console.WriteLine("Enter Dima's last mark: ");
                x = Int32.Parse(Console.ReadLine());
                ya[ya.Length - 1] = x;;
            }
            catch
            {
                Console.ForegroundColor = ConsoleColor.Yellow;
                Console.WriteLine("Wrong value entered");
                Console.ResetColor();
            }



            Student Pasha = new Student(10, "BSUIR");

            Pasha.Mess += DisplayMessageAdvanced;

            Pasha.Mess += delegate()
            {
                Console.WriteLine("\nHello, Console! New student added to the data base.");
            };

            Pasha.Surname = "Krivetskiy";
            Pasha.Adress  = "Dom";

            try
            {
                int x;
                Console.WriteLine("Enter Pasha's height: ");
                x            = Int32.Parse(Console.ReadLine());
                Pasha.Height = x;
            }
            catch
            {
                Console.ForegroundColor = ConsoleColor.Blue;
                Console.WriteLine("Wrong value entered");
                Console.ResetColor();
            }


            AgeComparer comparator = new AgeComparer();

            comparator.Compare(ya, Pasha);


            {
                ya.Mess -= DisplayMessageAdvanced;

                ya.Mess -= delegate()
                {
                    Console.WriteLine("\n|CONSOLE MESSAGE| New seminarist added to the data base.");
                };

                Pasha.Mess -= DisplayMessageAdvanced;

                Pasha.Mess -= delegate()
                {
                    Console.WriteLine("\n|CONSOLE MESSAGE| New student added to the data base.");
                };
            }
        }