java - Four Way Intersection Simulation -
i'm trying write program displays light sequences @ 4 way intersection. the direcitons are: at given time traffic can move in 1 direction. traffic lights have 3 colors red, yellow , green. based on event. lights change color in synchronized way allow safe driving. define class called “trafficlight” has 2 methods. 1 called “change” , called “getcolor”. in separate class “assignment5”, main entry point, want create 4 trafficlight instances 2 north/south traffic , 2 east/west traffic. using 2 methods objects provide want show have correctly simulated 4 way traffic light. so far have: public class trafficlight { /** * @param args */ public trafficlight(int c){ this.c = c; }//end constructor public int getc(){ return c; } java.lang.string getcolor; string n = "gyr"; string s = "gyr"; string e = "gyr"; string w = "gyr"; public void change(){ int c = 1; while (c <= 4){ ...