コード例 #1
0
ファイル: Program.cs プロジェクト: james-leung/c-sharp-fun
        static void Main(string[] args)
        {
            DeveloperReport dev1 = new DeveloperReport {
                Id = 1, Name = "Richard", Level = "Junior developer", HourlyRate = 50, WorkingHours = 160
            };
            DeveloperReport dev2 = new DeveloperReport {
                Id = 2, Name = "Ian", Level = "Senior developer", HourlyRate = 70, WorkingHours = 160
            };
            DeveloperReport dev3 = new DeveloperReport {
                Id = 3, Name = "Aaron", Level = "Software Engineer", HourlyRate = 60, WorkingHours = 168
            };

            var devCalculations = new SalaryCalculator(new List <BaseSalaryCalculator> {
                new JuniorDevSalaryCalculator(dev1), new SeniorDevSalaryCalculator(dev2), new JuniorDevSalaryCalculator(dev3)
            });

            Console.WriteLine($"The total salary of the employees is ${devCalculations.CalculateTotalSalary()}");
        }
コード例 #2
0
 public JuniorDevSalaryCalculator(DeveloperReport developerReport)
     : base(developerReport)
 {
 }
コード例 #3
0
 public SeniorDevSalaryCalculator(DeveloperReport report) : base(report)
 {
 }
コード例 #4
0
 public BaseSalaryCalculator(DeveloperReport developerReport)
 {
     DeveloperReport = developerReport;
 }