Exemple #1
0
        public void Payday(Paycheck paycheck)
        {
            double grossPay   = Classification.CalculatePay(paycheck);
            double deductions = affiliation.CalculateDeductions(paycheck);
            double netPay     = grossPay - deductions;

            paycheck.GrossPay   = grossPay;
            paycheck.Deductions = deductions;
            paycheck.NetPay     = netPay;
            Method.Pay(paycheck);
        }
Exemple #2
0
        public override double CalculatePay(Paycheck paycheck)
        {
            double totalPay = 0.0;

            foreach (TimeCard timeCard in timeCards.Values)
            {
                if (DateUtil.IsInPayPeriod(timeCard.Date,
                                           paycheck.PayPeriodStartDate,
                                           paycheck.PayPeriodEndDate))
                {
                    totalPay += CalculatePayForTimeCard(timeCard);
                }
            }
            return(totalPay);
        }
Exemple #3
0
        public override void Execute()
        {
            var empIds = database.GetAllEmployeeIds();

            foreach (int empId in empIds)
            {
                Employee employee = database.GetEmployee(empId);
                if (employee.IsPayDate(payDate))
                {
                    DateTime startDate =
                        employee.GetPayPeriodStartDate(payDate);
                    Paycheck pc = new Paycheck(startDate, payDate);
                    paychecks[empId] = pc;
                    employee.Payday(pc);
                }
            }
        }
Exemple #4
0
        public double CalculateDeductions(Paycheck paycheck)
        {
            double totalDues = 0;

            int fridays = NumberOfFridaysInPayPeriod(
                paycheck.PayPeriodStartDate, paycheck.PayPeriodEndDate);

            totalDues = dues * fridays;

            foreach (ServiceCharge charge in charges.Values)
            {
                if (DateUtil.IsInPayPeriod(charge.Time,
                                           paycheck.PayPeriodStartDate,
                                           paycheck.PayPeriodEndDate))
                {
                    totalDues += charge.Amount;
                }
            }

            return(totalDues);
        }
Exemple #5
0
 public override double CalculatePay(Paycheck paycheck)
 {
     return(salary);
 }