Skip to content

Latest commit

 

History

History
47 lines (34 loc) · 1.95 KB

absence-calculation-engine.md

File metadata and controls

47 lines (34 loc) · 1.95 KB

Absence calculation engine

You are tasked with making an Absence Calculation Engine.
Employees have to work a planned amount of hours per day.
When they don't come to work, absence has to be planned.

There are 3 types of absence: Paid Leave, Public Holiday, Sick Leave

You have to create a program where you can add a certain amount of hours of absence on a day and see the outcome.
The outcome doesn't just show the final outcome, but also shows what originally was planned on that day (see examples).

The absences have different priorities:

  • all absences overrule Work
  • Sick Leave overrules Paid Leave
  • Public Holiday overrules both Sick Leave and Paid Leave

These are some examples:

Given an employee is expected to work 8 hours on July 16th Then the employee sees 8 hours of work on July 16th

Given an employee is expected to work 8 hours on July 16th When employee books 8 hours of Paid Leave on July 16th Then the employee sees 8 hours of Paid Leave And sees 0 hours of Work (+ 8 hours of overruled Work)

Given an employee is expected to work 8 hours on July 16th When employee books 4 hours of Paid Leave on July 16th Then the employee sees 4 hours of Paid Leave And sees 4 hours of Work (+ 4 hours of overruled Work)

Given an employee is expected to work 8 hours on July 16th When employee books 4 hours of Paid Leave on July 16th And employee books 8 hours of Sick Leave on July 16th Then the employee sees 8 hours of Sick Leave And sees 0 hours of Paid Leave (+ 4 hours of overruled Paid Leave) And sees 0 hours of Work (+ 8 hours of overruled Work)

To keep things simple, you can:

  • assume that employees have to work a fixed amount of 8 hours each day
  • work with a single employee and a single day.

Extensions:

  • allow multiple day input, for example: book Sick Leave from July 15h until July 18th and book Paid Leave from the 17th to the 25th of July
  • make the Work flexible (so not always 8 hours)