/* a traffic generator */ public class Generator{ //each road, on each time step, has PERCENT chance of receiving a Car private static final double PERCENT = 0.25; //helper function to randomly pick a direction private int randDirection(){ double d = Math.random(); if(d<0.333)return Car.LEFT; if(d<0.666)return Car.RIGHT; return Car.STRAIGHT; } //addTraffic can add cars to the queues //all newly instatiated Cars should use the provided time parameter public void addTraffic(Queue[] streets, int time){ //for each street we randomly decide to add a Car for(int i=0;i<4;i++){ if(Math.random()