This is java program- and I need the testdriver for the progam \"Create a system
ID: 663553 • Letter: T
Question
This is java program- and I need the testdriver for the progam
"Create a system to simulate vehicles at an intersection. Assume that there is one lane going in each of four directions, with stoplights facing each direction. Vary the arrival average of vehicles in each direction and the frequency of the light changes to view the "behavior" of the intersection."
You canNOT use the Java built-in Queue or Deque class. Use an Array or Linked List implementation of a queue as explained in the text.
Include user-defined exceptions and javadoc comments.
Be sure to test thoroughly, and document your results.
Be sure to label your outputs so that when I run your code I can readily understand what you're doing.
Explanation / Answer
public class CarArray { public static void main( String[] args ) { Car[] carArray = new Car[3]; carArray[0] = new Car(4, "BMW"); carArray[1] = new Car(6, "Toyota"); carArray[2] = new Car(2, "Honda"); for (Car eachCar: carArray){ System.out.println(eachCar.getName()); eachCar.wheels(); } } }
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.