Advertisement
Guest User

Untitled

a guest
Oct 28th, 2016
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. public class TrafficQueue {
  2. private Car [] carArray;
  3. private int numberOfcarsInQueue;
  4.  
  5.  
  6. public TrafficQueue(int numberOfcarsInQueue){
  7. carArray = new Car[numberOfcarsInQueue];
  8.  
  9.  
  10. }
  11. private class Car {} ; // define an empty Car class
  12.  
  13.  
  14. public void add(Car car){
  15. carArray[numberOfcarsInQueue] = car;
  16. numberOfcarsInQueue ++;
  17.  
  18. }
  19.  
  20. public static void main(String[] args) {
  21. // TODO code application logic here
  22.  
  23.  
  24. TrafficQueue queueLane1 = new TrafficQueue(10);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement