Beispiel #1
0
        static void Main(string[] args)
        {
            Employee[] emps =
            {
                new Employee {
                    FirstName = "Bart", LastName = "Simpson", BaseSalary = 1000
                },
                new Employee {
                    FirstName = "Lisa", LastName = "Simpson", BaseSalary = 1200
                },
                new Manager  {
                    FirstName = "Clark", LastName = "Kent", BaseSalary = 2000, SalesPercentage = .2
                },
                new Manager  {
                    FirstName = "Homer", LastName = "Simpson", BaseSalary = 1500, SalesPercentage = .1
                },
                new Employee {
                    FirstName = "Marge", LastName = "Simpson", BaseSalary = 1400
                }
            };

            var personnel = new PersonnelManager();

            personnel.AddRange(emps);
            personnel.DisplayEmployees(Console.Out);
            personnel.WriteSalaries(@"c:\temp\salaries.dat");

            PersonnelDisplay display = new PersonnelDisplay(personnel);

            display.WriteSalaries(Console.Out);
        }
Beispiel #2
0
        static void Main(string[] args)
        {
            Employee[] emps =
            {
                new Employee(1)
                {
                    FirstName = "Bart", LastName = "Simpson", BaseSalary = 1000
                },
                new Employee(2)
                {
                    FirstName = "Lisa", LastName = "Simpson", BaseSalary = 1200
                },
                new Manager(100)
                {
                    FirstName = "Clark", LastName = "Kent", BaseSalary = 2000, SalesPercentage = .2
                },
                new Manager(101)
                {
                    FirstName = "Homer", LastName = "Simpson", BaseSalary = 1500, SalesPercentage = .1
                },
                new Employee(4)
                {
                    FirstName = "Marge", LastName = "Simpson", BaseSalary = 1400
                }
            };

            PersonnelManager.DisplayEmployees(emps);
            PersonnelManager.WriteSalaries(emps, @"c:\temp\salaries.dat");
        }
Beispiel #3
0
 public PersonnelDisplay(PersonnelManager mgr)
 {
     _mgr = mgr;
 }