THIS TRAFFIC CONTROLLER HAS BEEN MADE USING CORE JAVA, AND SWING API FOR THE GUI COMPONENTS. IT GIVES THE USER CONTROL OF 4 TRAFFIC LIGHTS AT A ROAD INTERSECTION. THE USER CAN TURN THE LIGHTS RED OR GREEN AND THEREFORE CONTROL THE TRAFFIC. IT PROVES TO BE A LEARNING EXPERIENCE ABOUT HOW TRAFFIC CAN BE CONTROLLED AND HOW MACHINE AUTOMATION CAN MAKE THE TOUGH TASK VERY EASY.
THE PROGRAM CONSISTS OF ONE CLASS FILE, AND CAN BE EITHER RUN ON AN IDE LIKE NETBEANS/ECLIPSE/INTELLIJ OR CAN BE COMPILED(USING JDK11 or ABOVE) AND RUN USING CMD IN THE FOLLOWING MANNER -
- OPEN COMMAND PROMPT AND NAVIGATE TO THE "src" FOLDER IN THE PROVIDED "TrafficCTRLv3" FOLDER.
- ONCE INSIDE THE "src" DIRECTORY, TYPE THE FOLLOWING COMMAND - javac trafficctrlv3/CTRLv3.java
- ONCE THE PROGRAM HAS COMPILED AND CMD PROMPTS TO ENTER NEXT COMMAND, THE USER CAN RUN THE PROGRAM BY TYPING THE FOLLOWING COMMAND - java trafficctrlv3.CTRLv3
- THE TRAFFIC CONTROLLER WINDOW OPENS. PRESS THE "START" BUTTON TO START THE EXECUTION.
THE TRAFFIC CONTROLLER STARTS ONCE THE "START" BUTTON HAS BEEN PRESSED. IT TURNS ALL LIGHTS GREEN AND THE CARS START MOVING. THE "RESET" BUTTON TURNS ALL LIGHTS TO RED. THE "EXIT" BUTTON STOPS THE PROGRAM. THE TRAFFIC LIGHTS CAN BE CLICKED INDIVIDUALLY TO CHANGE THEM FROM RED TO GREEN AND VICE-VERSA. THE CARS MOVE PAST THE LIGHT IF IT IS GREEN, AND STOP IF IT IS RED. THERE ARE A TOTAL OF 6 CARS MOVING IN THE FRAME. 4 OF THEM MOVE IN ONE DIRECTION, WHILE 2 OTHERS CHANGE LANES AT INTERSECTION. NO CAR IS ALLOWED TO MOVE PAST THE TRAFFIC LIGHT UNLESS THE TRAFFIC LIGHT IS GREEN.