Back to problems

Worker Attendance & Payroll

Object-Oriented Programming · Instacart · Medium

Requirements Level 1 Implement a worker tracker with the following operations: addWorker(id, position, compensation) creates a worker and stores the supplied metadata. register(id, timestamp) marks an attendance boundary. For a worker currently outside, the timestamp begins an office visit; for a worker currently inside, it ends that visit. get(id) reports the worker's accumulated time across all finished office visits. Level 2 topN(n) lists workers ordered by their total…

Checking your access…