Consider a traffic light controller for an intersection of a main street and a smaller street. Both streets are one-way streets. The intersection has two traffic lights, one for each street. In normal operations the main street light is always green unless cars arrive on the small street. In this case, the small street is given green until all cars have passed or 2 minutes have elapsed. The transition of green from one street to another street includes a 10-second period when the first street becomes orange and the second street remains red. For the emergency situation that an ambulance is approaching the intersection, the controller immediately turns both lights into red to indicate the emergency. After the emergency, the smaller street is turned green if it has cars. Otherwise, the main street is turned green
How to Create a Finite State Machine describing the central controller of this intersection. Also how to Draw a UML state chart diagram
Can we use the State Design Pattern to implement the finite state machine? Pointers towards some pseudo code would help.