The Lab Equipment Dispenser

About this Task

This task is a bit more complex and designed to familiarize you more with the subtle challenges of real-live programming.

  • While the programming structures that you know are perfectly sufficient to solve the task, the ways in which to apply them might not be obvious.
  • It is more complex than the tasks you have seen before. Instead of solving it in one go, you may want to solve a part of it, try that out and then continue on the next part.
  • It has a vague specification, meaning you are not told all details of the problem. In the cases where you lack information it is up to your best judgement to fill in the blanks. As long as the program fulfills the specified behaviour, it is considered correct.

Your lab is is supposed to get a new dispenser for safety equipment. Management decided that we can develop it cheaper in-house and tasked you with writing the bookkeeping program for it.

Some of your colleagues already went through a brain-storming session and came up with a flowchart that describes how the machine is supposed to work. They drew you this diagram before they left for a conference:

Kroki

Create a program that implements the specified behaviour.

Hints

Consider using functions to break down the complexity into something more manageable.