HARMAN interview question

How do you implement state machine.