コード例 #1
0
ファイル: ClassRoom.cs プロジェクト: 5avel/InheritanceTasks
 public ClassRoom(Pupil p0, Pupil p1)
 {
     pupils[0] = p0;
     pupils[1] = p1;
     pupils[2] = new BadPupil();
     pupils[3] = new ExcelentPupil();
 }
コード例 #2
0
ファイル: Program.cs プロジェクト: Anil1111/CS_Elementary_2
        static void Main(string[] args)
        {
            ExcelentPupil excelentPupil = new ExcelentPupil("S***n");
            BadPupil      badPupil      = new BadPupil("Stas");
            GoodPupil     goodPupil     = new GoodPupil("Leha");
            GoodPupil     goodPupil2    = new GoodPupil("Vasya");

            goodPupil.Study(4);
            goodPupil.Read(4);
            goodPupil.Write(4);
            goodPupil.Relax(3);

            goodPupil2.Study(4);
            goodPupil2.Read(4);
            goodPupil2.Write(4);
            goodPupil2.Relax(3);

            excelentPupil.Study(5);
            excelentPupil.Read(5);
            excelentPupil.Write(5);
            excelentPupil.Relax(2);

            badPupil.Study(2);
            badPupil.Read(2);
            badPupil.Write(2);
            badPupil.Relax(5);

            ClassRoom classRoom = new ClassRoom(goodPupil, goodPupil2, badPupil);

            classRoom.pupilsClass.Add(excelentPupil);
            classRoom.Show();
            Console.ReadLine();
        }
コード例 #3
0
        public override void Write()
        {
            base.Write();
            Console.Write("- пишут: ");
            int sum = 0;

            for (int i = 0; i < pupils.Length; i++)
            {
                if (excelentPupil == base.pupils[i])
                {
                    sum++;
                    ExcelentPupil excelentPupil = new ExcelentPupil(pupilOne, pupilTwo, pupilThree, pupilFour);
                    Console.Write(excelentPupil.pupils[i] + ", ");
                }
                if (i != (pupils.Length - 1))
                {
                    continue;
                }
                else if (excelentPupil != base.pupils[i] && sum == 0)
                {
                    Console.Write("No one");
                }
            }
            Console.WriteLine();
        }
コード例 #4
0
ファイル: Program.cs プロジェクト: IhorShulha/FullStackCourse
        static void Main(string[] args)
        {
            Console.WriteLine("Hello World!");

            Pupil test1 = new Pupil("Ivanov");
            Pupil test2 = new ExcelentPupil("Smith");
        }
コード例 #5
0
ファイル: Program.cs プロジェクト: archermarc085/Inheritance
 static void Main(string[] args)
 {
     ExcelentPupil excelent = new ExcelentPupil("Masha", "Ivanovna", 12);
     GoodPupil good = new GoodPupil("Petya", "Petrov", 11);
     ClassRoom classRoom = new ClassRoom(excelent, good);
     classRoom.OutputInformation();
     Console.ReadLine();
 }
コード例 #6
0
        public void ExcelentPupils()
        {
            ExcelentPupil excelentPupil = new ExcelentPupil(pupilOne, pupilTwo, pupilThree, pupilFour);

            excelentPupil.Study();
            excelentPupil.Read();
            excelentPupil.Write();
            excelentPupil.Relax();
        }
コード例 #7
0
ファイル: Program.cs プロジェクト: Stargik/C-Base
        static void Main(string[] args)
        {
            ExcelentPupil excelentPupil = new ExcelentPupil();
            GoodPupil     goodPupil     = new GoodPupil();
            BadPupil      badPupil      = new BadPupil();
            ClassRoom     classRoom     = new ClassRoom(excelentPupil, goodPupil, badPupil);

            classRoom.GetInformation();
        }
コード例 #8
0
        static void Main(string[] args)
        {
            Pupil     p1      = new ExcelentPupil("Ivan Ivanov");
            Pupil     p2      = new GoodPupil("Petr Zubov");
            ClassRoom class1A = new ClassRoom(p1, p2);

            class1A.Print();
            Console.ReadKey();
        }
コード例 #9
0
        static void Main(string[] args)
        {
            Pupil         p1            = new Pupil();
            Pupil         p2            = new Pupil();
            Pupil         p3            = new Pupil();
            ClassRoom     classRoom     = new ClassRoom(p1, p2, p3);
            ExcelentPupil excelentPupil = new ExcelentPupil();
            GoodPupil     goodPupil     = new GoodPupil();
            BadPupil      badPupil      = new BadPupil();

            p1.Read();
        }
コード例 #10
0
        static void Main(string[] args)
        {
            Pupil firstPupil  = new ExcelentPupil();
            Pupil secondPupil = new GoodPupil();
            Pupil thirdPupil  = new ExcelentPupil();
            Pupil fourthPupil = new BadPupil();

            ClassRoom classRoom = new ClassRoom(firstPupil, secondPupil, thirdPupil, fourthPupil);

            foreach (Pupil p in classRoom.Pupils)
            {
                p.Descr();
                p.Study();
                p.Read();
                p.Write();
                p.Relax();
                Console.WriteLine();
            }

            Console.ReadLine();
        }