예제 #1
0
        public override decimal CalculatePay(decimal hoursWorked, BiWeeklyPayPeriod payPeriod)
        {
            var straightTimeHours = Math.Min(hoursWorked, payPeriod.HoursPerPeriod);
            var timeAndAHalfHours = Math.Max(hoursWorked - payPeriod.HoursPerPeriod, 0);

            return (straightTimeHours * HourlyRate) + (timeAndAHalfHours * (HourlyRate * 1.5m));
        }
예제 #2
0
        public override decimal CalculatePay(decimal hoursWorked, BiWeeklyPayPeriod payPeriod)
        {
            var straightTimeHours = Math.Min(hoursWorked, payPeriod.HoursPerPeriod);
            var timeAndAHalfHours = Math.Max(hoursWorked - payPeriod.HoursPerPeriod, 0);

            return((straightTimeHours * HourlyRate) + (timeAndAHalfHours * (HourlyRate * 1.5m)));
        }
예제 #3
0
        public PayrollResult RunPayroll(BiWeeklyPayPeriod payPeriod, IEnumerable <Timecard> timecards)
        {
            var result = new PayrollResult();

            foreach (var timecard in timecards)
            {
                result.Paychecks.Add(new Paycheck
                {
                    Employee = timecard.Employee,
                    Amount   = timecard.CalculatePay(timecard, payPeriod)
                });
            }
            return(result);
        }
예제 #4
0
 public abstract decimal CalculatePay(decimal hoursWorked, BiWeeklyPayPeriod payPeriod);
예제 #5
0
 public decimal CalculatePay(Timecard timecard, BiWeeklyPayPeriod payPeriod)
 {
     return timecard.Employee.CalculatePay(HoursWorked, payPeriod);
 }
예제 #6
0
 public override decimal CalculatePay(decimal hoursWorked, BiWeeklyPayPeriod payPeriod)
 {
     return Salary / HoursPerYear * hoursWorked;
 }
예제 #7
0
 // Helper methods
 private void Given_a_bi_weekly_pay_period()
 {
     _payPeriod = new BiWeeklyPayPeriod();
 }
예제 #8
0
 public PayrollResult RunPayroll(BiWeeklyPayPeriod payPeriod, IEnumerable<Timecard> timecards)
 {
     var result = new PayrollResult();
     foreach (var timecard in timecards)
     {
         result.Paychecks.Add(new Paycheck
                                  {
                                      Employee = timecard.Employee,
                                      Amount = timecard.CalculatePay(timecard, payPeriod)
                                  });
     }
     return result;
 }
예제 #9
0
        // Helper methods

        private void Given_a_bi_weekly_pay_period()
        {
            _payPeriod = new BiWeeklyPayPeriod();
        }
예제 #10
0
 public abstract decimal CalculatePay(decimal hoursWorked, BiWeeklyPayPeriod payPeriod);
예제 #11
0
 public override decimal CalculatePay(decimal hoursWorked, BiWeeklyPayPeriod payPeriod)
 {
     return(Salary / HoursPerYear * hoursWorked);
 }
예제 #12
0
 public decimal CalculatePay(Timecard timecard, BiWeeklyPayPeriod payPeriod)
 {
     return(timecard.Employee.CalculatePay(HoursWorked, payPeriod));
 }