This problem was offered by Prof. Jan Vanthienen who is one of the best known experts in decision tables and a member of the DMN Task Force. You can see other vendor's solutions to this challenge here:  

Next month Prof. Vanthienen will provide his comparative analysis of different submitted representations along with his explanations of what constitutes a good decision table.

The Rules

  1. All employees get a minimum of 22 days
  2. Only employees younger than 18 or at least 60, or with at least 30 years of service receive 5 extra days 
  3. Employees with at least 30 years of service and also employees of age 60 or more receive 3 extra days on top of other days
  4. If an employee has at least 15 but less than 30 years of service 2 extra days are given. These 2 days are also provided for employees age 45 or more. They cannot be combined with the 5 extra days

Solution #1 shows how the problem can be solved using a single decision table to represent all the combinations of age and years of service that are referred to in (or implied by) the rules.

See also solution #2 which splits the decision into two parts: (a) determining eligibility for vacation and (b) calculating the actual number of days. This is a pattern that is often seen in welfare eligibility systems.

Extra Credit

Make these changes to your rules

  1. Under 18 base days is 15; 60 and over base days is 25
  2. Employees between 18 and 45 get 4 days if they have less than 30 year’s service
  3. Employees over 45 get 1 extra day if they have less than 15 year’s service
  4. All days can be combined