<p>HI I got this coursework question to solve. </p>

<p>This is the question:</p>

<p>Design a program to simulate vehicles at an intersection.</p>

<p>Assume that there is one lane going in each of four directions, with stoplights facing each direction. Vary the arrival time of vehicles randomly in each direction and set up a regular frequency of the light changes. Run your direction and set up a regular frequency of the light changes. Run your simulation for a set period of time to view the "behaviour" of the intersection. </p>

<p>Coursework Requirement:</p>

<ol>
<li>Should be coded in java</li>
<li>Use of proper data structures</li>
</ol>

<p>If any one has any clue of how to do it, please help; I have no idea.</p>

Read
about
queues
you have to use to simulate each traffic light.
Each randomly generated car going in each lane will get pushed into the corresponding queue and then popped out of it when the light is green, and keep popping cars as long as (hint: you need to simulate time as well (subhint: look into finite state machines)) the light is green, of course. You process each queue in order.