Пример #1
0
        /// <summary>
        /// Puts in array different emloyees
        /// </summary>
        public Company()
        {
            int numberOfJunior = 20;
            int numberOfMiddle = 15;
            int numberOfSenior = 10;

            for (int i = 0; i < numberOfJunior; i++)
            {
                employee[i] = new Junior();
                employees.Add(employee[i]);
            }
            for (int i = numberOfJunior; i < numberOfJunior + numberOfMiddle; i++)
            {
                employee[i] = new Middle();
                employees.Add(employee[i]);
            }
            for (int i = numberOfJunior + numberOfMiddle; i < numberOfJunior + numberOfMiddle + numberOfSenior; i++)
            {
                employee[i] = new Senior();
                employees.Add(employee[i]);
            }
            for (int i = numberOfJunior + numberOfMiddle + numberOfSenior; i < numberOfEmployees; i++)
            {
                employee[i] = new Lead();
                employees.Add(employee[i]);
            }
        }
Пример #2
0
        public override List <Employee> Choose(List <Employee> employees, int efficiency)
        {
            List <Employee> workingEmployees = new List <Employee> {
            };
            Middle   middle = new Middle();
            Senior   senior = new Senior();
            Lead     lead   = new Lead();
            Employee checkEmployee;

            while (efficiency > 1)
            {
                if (efficiency >= lead.Efficiency && null != (checkEmployee = employees.Find(item => item.Salary == lead.Salary)))
                {
                    efficiency -= lead.Efficiency;
                    workingEmployees.Add(checkEmployee);
                    employees.Remove(checkEmployee);
                    continue;
                }
                if (efficiency >= senior.Efficiency && null != (checkEmployee = employees.Find(item => item.Salary == senior.Salary)))
                {
                    efficiency -= senior.Efficiency;
                    workingEmployees.Add(checkEmployee);
                    employees.Remove(checkEmployee);
                    continue;
                }
                if (efficiency >= middle.Efficiency && null != (checkEmployee = employees.Find(item => item.Salary == middle.Salary)))
                {
                    efficiency -= middle.Efficiency;
                    workingEmployees.Add(checkEmployee);
                    employees.Remove(checkEmployee);
                    continue;
                }
            }
            return(workingEmployees);
        }
Пример #3
0
        public override List <Employee> Choose(List <Employee> employees, int money)
        {
            List <Employee> workingEmployees = new List <Employee> {
            };
            Junior   junior = new Junior();
            Middle   middle = new Middle();
            Senior   senior = new Senior();
            Lead     lead   = new Lead();
            Employee checkEmployee;

            while (money >= junior.Salary)
            {
                if (money >= lead.Salary && null != (checkEmployee = employees.Find(item => item.Salary == lead.Salary)))
                {
                    workingEmployees.Add(checkEmployee);
                    employees.Remove(checkEmployee);
                    money = money - lead.Salary;
                    continue;
                }

                if (money >= senior.Salary && null != (checkEmployee = employees.Find(item => item.Salary == senior.Salary)))
                {
                    workingEmployees.Add(checkEmployee);
                    employees.Remove(checkEmployee);
                    money = money - senior.Salary;
                    continue;
                }

                if (money >= middle.Salary && null != (checkEmployee = employees.Find(item => item.Salary == middle.Salary)))
                {
                    workingEmployees.Add(checkEmployee);
                    employees.Remove(checkEmployee);
                    money = money - middle.Salary;
                    continue;
                }
                else
                {
                    if (null != (checkEmployee = employees.Find(item => item.Salary == junior.Salary)))
                    {
                        workingEmployees.Add(checkEmployee);
                        employees.Remove(checkEmployee);
                        money = money - junior.Salary;
                        continue;
                    }
                }
            }
            return(workingEmployees);
        }