Objective: Implement a traffic-signal abstraction whose public operations preserve the legal state-transition order.
Create an abstract TrafficSignal class with three states: STOP, GO, and CAUTION. A signal starts at STOP and advances only in this cycle:
STOP -> GO -> CAUTION -> STOP
Do not expose a public method that permits an arbitrary state assignment. The transition operation owns the invariant.
requestPassage(). A request is recorded only while the signal is stopped.changeState(). Entering GO automatically clears a pending passage request.getMessage() method.TrafficLight and WalkSign subclasses that return the appropriate message for each state.