Ejemplo n.º 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);
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 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);
                }
            }
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 5
0
 public override double CalculatePay(Paycheck paycheck)
 {
     return(salary);
 }