コード例 #1
0
ファイル: Program.cs プロジェクト: rumiantsau88/OOP
        static void Main(string[] args)
        {
            Pupil     p1     = new ExcellentPupil();
            Pupil     p2     = new GoodPupil();
            ClassRoom _class = new ClassRoom(p1, p2);

            _class.Read();
            _class.Write();
            _class.Relax();
            _class.Study();
            Console.ReadKey();
        }
コード例 #2
0
        static void Main(string[] args)
        {
            ClassRoom cr = new ClassRoom(new ExcelentPupil(), new GoodPupil(), new BadPupil(), new GoodPupil());

            cr.printIWrite();
            Console.WriteLine("------------------------------------------");
            cr.printRead();
            Console.WriteLine("------------------------------------------");
            cr.printStudy();
            Console.WriteLine("------------------------------------------");
            cr.printRelax();
        }
コード例 #3
0
        static void Main(string[] args)
        {
            ClassRoom ClassName = new ClassRoom();

            ClassName.ClassName     = "3Q";
            ClassName.SemesterStart = new DateTime(2019, 8, 26);
            ClassName.ClassList     = new List <Student>
            {
                new Student("Aukse", 8, 17),
                new Student("Vlad", 3, 21)
            };
        }
コード例 #4
0
ファイル: Program.cs プロジェクト: Anil1111/CS_Elementary_2
        static void Main(string[] args)
        {
            ClassRoom classRoomOne = new ClassRoom();

            Start();

            void Start()
            {
                Console.Clear();
                Console.WriteLine("Опции: \n1. Добавить зрачок.\n2. Инфа по зрачкам");
                switch (Console.ReadLine())
                {
                case "1":
                    AddPupil();
                    break;

                case "2":
                    ShowInfo();
                    break;

                default:
                    break;
                }
            }

            void ShowInfo()
            {
                classRoomOne.ClassRoomInfo();
                Console.ReadLine();
                Start();
            }

            void AddPupil()
            {
                do
                {
                    Console.Clear();
                    Console.WriteLine("Введите Имя и пять параметров(Смекалка, Бодрость, Эмоциональное состояние, Физическое состояние, Самооценка) пожалуйста:");
                    classRoomOne.addPupil((new Pupil(Console.ReadLine(), Int32.Parse(Console.ReadLine()), Int32.Parse(Console.ReadLine()), Int32.Parse(Console.ReadLine()), Int32.Parse(Console.ReadLine()), Int32.Parse(Console.ReadLine()))));
                    classRoomOne.Identify();

                    Console.WriteLine("Еще?\n 1: ДА\n 2: НЕ...");
                }while (Console.ReadKey().Key != ConsoleKey.D2);

                Start();
            }

            Console.ReadLine();
        }
コード例 #5
0
        static void Main(string[] args)
        {
            Pupil pupil_1 = new ExcelentPupil();
            Pupil pupil_2 = new GoodPupil();

            ClassRoom classRoom = new ClassRoom(new Pupil[] { pupil_1, pupil_2 });

            Console.WriteLine("Study");
            classRoom.Study();

            Console.WriteLine("Read");
            classRoom.Read();

            Console.ReadKey();
        }
コード例 #6
0
        static void Main(string[] args)
        {
            Pupil p1 = new BadPupil();
            Pupil p2 = new ExcelentPupil();
            Pupil p3 = new ExcelentPupil();

            ClassRoom group = new ClassRoom(p1, p2, p3);

            group.Study();
            Console.WriteLine(new string('-', 30));
            group.Read();
            Console.WriteLine(new string('-', 30));
            group.Write();
            Console.WriteLine(new string('-', 30));
            group.Relax();

            Console.ReadKey();
        }
コード例 #7
0
        static void Main(string[] args)
        {
            ClassRoom classroom = new ClassRoom();

            classroom.classname     = "3B";
            classroom.semesterstart = new DateTime(2018, 9, 4);
            classroom.classlist     = new List <Student>();

            Student studentOne   = new Student("Mads", 2, 3);
            Student studentTwo   = new Student("Bastian", 7, 17);
            Student studentThree = new Student("Michael", 12, 29);

            classroom.classlist.Add(studentOne);
            classroom.classlist.Add(studentTwo);
            classroom.classlist.Add(studentThree);

            classroom.classlist.ForEach(Console.WriteLine);
            // Output forkert, ved ikke hvorfor
        }
コード例 #8
0
        static void Main(string[] args)
        {
            ClassRoom myClass = new ClassRoom();

            myClass.ClassName = "3Q";
            myClass.Students.Add(new Student(3, 9, "Popular"));
            myClass.Students.Add(new Student(29, 1, "Khem"));
            myClass.Students.Add(new Student(12, 6, "Ganga"));

            Console.WriteLine(myClass.ClassName);
            Console.WriteLine(myClass.SemesterStart.ToString());

            foreach (var item in myClass.Students)
            {
                Console.WriteLine(item.Name + " " + item.BirthDay + " " + item.BirthMonth);
            }
            Console.WriteLine(myClass.NoOfStudentsWithBirthMonth(1).ToString());
            Console.ReadLine();
        }
コード例 #9
0
        static void Main(string[] args)
        {
            Console.WriteLine("firstclass");
            Console.WriteLine(new string('-', 70));
            ClassRoom firstclass = new ClassRoom(new BadPupil(), new GoodPupil());

            firstclass.Show();

            Console.WriteLine("secondclass");
            Console.WriteLine(new string ('-', 70));
            ClassRoom secondclass = new ClassRoom(new BadPupil(), new GoodPupil(), new ExcelentPupil());

            secondclass.Show();

            Console.WriteLine("thirdclass");
            Console.WriteLine(new string('-', 70));
            ClassRoom thirdclass = new ClassRoom(new GoodPupil(), new GoodPupil(), new GoodPupil(), new GoodPupil());

            thirdclass.Show();
        }
コード例 #10
0
        static void Main(string[] args)
        {
            ClassRoom class3b = new ClassRoom("3B", DateTime.Parse("4-9-2018"));

            Student stud1 = new Student("Nicolai Vagner", 10, 18);
            Student stud2 = new Student("Bastian Mødekjær", 02, 01);
            Student stud3 = new Student("Anders Jagd", 12, 04);
            Student stud4 = new Student("John Knudsen", 65, 04);
            Student stud5 = new Student("Hans Jørgensen", -51, 04);

            class3b.AddStudentToClass(stud1);
            class3b.AddStudentToClass(stud2);
            class3b.AddStudentToClass(stud3);
            class3b.AddStudentToClass(stud4);
            class3b.AddStudentToClass(stud5);

            class3b.PrintAllInfo();

            class3b.CountSeasonBirthdays();

            Console.WriteLine("\n\nPress any key to close...");
            Console.ReadKey();
        }
コード例 #11
0
        static void Main(string[] args)
        {
            ClassRoom myClass = new ClassRoom();

            myClass.ClassName     = "3Q";
            myClass.SemesterStart = new DateTime(2019, 8, 26);
            myClass.Students.Add(new Student(4, 10, "Andrei"));
            myClass.Students.Add(new Student(10, 6, "Will"));
            myClass.Students.Add(new Student(17, 10, "Bartosz"));

            // throws month out of range exception
            // myClass.Students.Add(new Student(14, 14, "Greg"));
            //

            Console.WriteLine(myClass.ClassName);
            Console.WriteLine(myClass.SemesterStart.ToString());
            foreach (var item in myClass.Students)
            {
                Console.WriteLine(item.Name + " " + item.BirthDay + " " + item.BirthMonth);
            }
            Console.WriteLine(myClass.NumberOfPeopleWithBirhtMonth(10).ToString());

            Console.ReadLine();
        }