Handshake interview question

Design a vending machine that follows the given spec.