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)); }
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))); }
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); }
public abstract decimal CalculatePay(decimal hoursWorked, BiWeeklyPayPeriod payPeriod);
public decimal CalculatePay(Timecard timecard, BiWeeklyPayPeriod payPeriod) { return timecard.Employee.CalculatePay(HoursWorked, payPeriod); }
public override decimal CalculatePay(decimal hoursWorked, BiWeeklyPayPeriod payPeriod) { return Salary / HoursPerYear * hoursWorked; }
// Helper methods private void Given_a_bi_weekly_pay_period() { _payPeriod = new BiWeeklyPayPeriod(); }
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; }
public override decimal CalculatePay(decimal hoursWorked, BiWeeklyPayPeriod payPeriod) { return(Salary / HoursPerYear * hoursWorked); }
public decimal CalculatePay(Timecard timecard, BiWeeklyPayPeriod payPeriod) { return(timecard.Employee.CalculatePay(HoursWorked, payPeriod)); }