示例#1
0
        static void Main()
        {
            // підключення Unicode
            Console.OutputEncoding = Encoding.Unicode;

            // краще створити масивом
            Worker[] workers = new Worker[3];

            // присвоєння даних
            workers[0] = new Worker()
            {
                Name           = "Vlad",
                Age            = 26,
                WorkExperience = 5
            };
            workers[1] = new Worker("Vadim", 28);
            workers[2] = new Worker("Bogdan", 27, 3);

            // виведення даних
            for (int i = 0; i < workers.Length; i++)
            {
                workers[i].ShowWorkerInfo();
            }

            // delay
            Console.ReadKey(true);
        }
示例#2
0
        public static ISalaryGetter Parse(string type)
        {//для создания mock-объектов
            ISalaryGetter employee = null;

            switch (type)
            {
            case "Engineer": employee = new Workers.Engineer(1, 1, 1); break;

            case "Manager": employee = new Workers.Manager(1, 1, 1); break;

            case "Worker": employee = new Workers.Worker(1, 1, 1); break;
            }
            return(employee);
        }
示例#3
0
    { // класс определяющий, какого работника мы рассматрваем
        public static ISalaryGetter Parse(string type, double salaryValue, double workTimeValue, double additionalFactorValue)
        {
            ISalaryGetter employee = null;

            switch (type)
            {
            case "Engineer": employee = new Workers.Engineer(salaryValue, workTimeValue, additionalFactorValue); break;

            case "Manager": employee = new Workers.Manager(salaryValue, workTimeValue, additionalFactorValue); break;

            case "Worker": employee = new Workers.Worker(salaryValue, workTimeValue, additionalFactorValue); break;
            }
            return(employee);
        }