Continental Interview Question

State machine implementation. Implement certain feature in concept.