Visteon interview question

Write a code for a state machine