daily pastebin goal
12%
SHARE
TWEET

Untitled

a guest May 16th, 2018 93 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. public interface EmployeeFactory
  2. {
  3.     Employee CreateEmployeeByType(EmployeeType employeeType);
  4. }
  5.  
  6. public class EmployeeFactoryImpl : EmployeeFactory
  7. {
  8.     public Employee CreateEmployeeByType(EmployeeType type)
  9.     {
  10.         switch (type)
  11.         {
  12.             case EmployeeType.COMMISSIONED:
  13.                 return new CommissionedEmployee();
  14.             case EmployeeType.HOURLY:
  15.                 return new HourlyEmployee();
  16.             case EmployeeType.SALARIED:
  17.                 return new SalariedEmploye();
  18.             default:
  19.                 throw new ArgumentOutOfRangeException("type");
  20.         }
  21.     }
  22. }
  23.  
  24. public class CommissionedEmployee : Employee
  25. {
  26.     public override bool IsPayday() { throw new NotImplementedException(); }
  27.  
  28.     public override Money CalculatePay() { throw new NotImplementedException(); }
  29.  
  30.     public override void DeliverPay(Money pay) { throw new NotImplementedException(); }
  31. }
  32.  
  33. public class HourlyEmployee : Employee…
  34.  
  35. public class SalariedEmploye : Employee…
  36. }
RAW Paste Data
Top