コード例 #1
0
ファイル: Man.cs プロジェクト: xs2ranjeet/13ns9-1spr
        public void CreateListStudent(Man man, string str)
        {
            int count;
            Console.Write("Enter the number :");
            count = int.Parse(Console.ReadLine());
            switch (str)
            {
                case "STUDENT":
                    Student[] st = new Student[count];
                    for (int i = 0; i < count; i++)
                    {
                        st[i] = new Student();
                        Console.Write("Enter Name Student № {0} :", i);
                        st[i].Name = Console.ReadLine();
                        Console.Write("Enter LastName Student № {0} :", i);
                        st[i].LastName = Console.ReadLine();
                        Console.Write("Enter AverageBall Student № {0} :", i);
                        st[i].AverageBall = Console.ReadLine();
                        Console.Write("Enter YearBirth  Student № {0} :", i);
                        st[i].YearBirth = Console.ReadLine();


                        man.ListStudent.Add(st[i]);
                    }
                    break;
                case "TEACHER":
                    Teacher[] teacher = new Teacher[count];
                    for (int i = 0; i < count; i++)
                    {
                        teacher[i] = new Teacher();
                        Console.Write("Enter Name Teacher № {0} :", i);
                        teacher[i].Name = Console.ReadLine();
                        Console.Write("Enter Last Name Teacher № {0} :", i);
                        teacher[i].LastName = Console.ReadLine();
                        Console.Write("Enter Salary Teacher № {0} :", i);
                        teacher[i].Salary = Console.ReadLine();
                        Console.Write("Enter Name School № {0} :", i);
                        teacher[i].NameShool = Console.ReadLine();
                        man.ListTeacher.Add(teacher[i]);
                    }
                    break;
                case "ACCOUNTANT":
                    Accountant[] accountant =new Accountant[count];
                    for (int i = 0; i < count; i++)
                    {
                        accountant[i] = new Accountant();
                        Console.Write("Enter Name Accountant № {0} :", i);
                        accountant[i].Name = Console.ReadLine();
                        Console.Write("Enter Last Name Accountant № {0} :", i);
                        accountant[i].LastName = Console.ReadLine();
                        Console.Write("Enter Salary Accountant № {0} :", i);
                        accountant[i].Salary = Console.ReadLine();
                        Console.Write("Enter Name School № {0} :", i);
                        accountant[i].NameShool = Console.ReadLine();
                        man.ListAccountant.Add(accountant[i]);
                    }
                    break;
                default:
                    break;
            }

            Console.Clear();
        }
コード例 #2
0
ファイル: Man.cs プロジェクト: mkbiltek2019/Lesons_SAG
        public void CreateListStudent(Man man, string str)
        {
            int count;

            Console.Write("Enter the number :");
            count = int.Parse(Console.ReadLine());
            switch (str)
            {
            case "STUDENT":
                Student[] st = new Student[count];
                for (int i = 0; i < count; i++)
                {
                    st[i] = new Student();
                    Console.Write("Enter Name Student № {0} :", i);
                    st[i].Name = Console.ReadLine();
                    Console.Write("Enter LastName Student № {0} :", i);
                    st[i].LastName = Console.ReadLine();
                    Console.Write("Enter AverageBall Student № {0} :", i);
                    st[i].AverageBall = Console.ReadLine();
                    Console.Write("Enter YearBirth  Student № {0} :", i);
                    st[i].YearBirth = Console.ReadLine();


                    man.ListStudent.Add(st[i]);
                }
                break;

            case "TEACHER":
                Teacher[] teacher = new Teacher[count];
                for (int i = 0; i < count; i++)
                {
                    teacher[i] = new Teacher();
                    Console.Write("Enter Name Teacher № {0} :", i);
                    teacher[i].Name = Console.ReadLine();
                    Console.Write("Enter Last Name Teacher № {0} :", i);
                    teacher[i].LastName = Console.ReadLine();
                    Console.Write("Enter Salary Teacher № {0} :", i);
                    teacher[i].Salary = Console.ReadLine();
                    Console.Write("Enter Name School № {0} :", i);
                    teacher[i].NameShool = Console.ReadLine();
                    man.ListTeacher.Add(teacher[i]);
                }
                break;

            case "ACCOUNTANT":
                Accountant[] accountant = new Accountant[count];
                for (int i = 0; i < count; i++)
                {
                    accountant[i] = new Accountant();
                    Console.Write("Enter Name Accountant № {0} :", i);
                    accountant[i].Name = Console.ReadLine();
                    Console.Write("Enter Last Name Accountant № {0} :", i);
                    accountant[i].LastName = Console.ReadLine();
                    Console.Write("Enter Salary Accountant № {0} :", i);
                    accountant[i].Salary = Console.ReadLine();
                    Console.Write("Enter Name School № {0} :", i);
                    accountant[i].NameShool = Console.ReadLine();
                    man.ListAccountant.Add(accountant[i]);
                }
                break;

            default:
                break;
            }

            Console.Clear();
        }