title: Find Average Queue length and Average time a object spends on a queue
body: <p>Im building a program that stimulates a airport's operation, where planes land and take off. Landing planes of a priority over take off planes but they are two separate queues.<br>
  Planes are added and removed from the queues randomly. What will be the best way way to calculate the average queue length of landingQueue and takeOffQueue as well as determine how long a plane spends time on the queue. </p>
  
  <p>Random generator = new Random(System.currentTimeMillis());</p>
  
  <pre><code>ArrayQueue&lt;Double&gt; landingQueue = new ArrayQueue&lt;&gt;();
  ArrayQueue&lt;Double&gt; takeOffQueue = new ArrayQueue&lt;&gt;();
  ArrayQueue&lt;Integer&gt; averageLengthQueue = new ArrayQueue&lt;&gt;();
  boolean runwayIsFree = false;
  double mins = 0;
  
  for(int i = 0; i &lt; 1000; i += 60) {
      double rand1 = generator.nextDouble();
      double rand2 = generator.nextDouble();
  
      if(rand1 &lt; .16)
          landingQueue.enqueue(rand1);
      if(rand2 &lt; .14)
          takeOffQueue.enqueue(rand2);
  
      if(mins == 0)
          runwayIsFree = true;
      if(runwayIsFree) {
          if(!landingQueue.isEmpty()) {
              landingQueue.dequeue();
              mins = 3;
          }
          else if(!takeOffQueue.isEmpty()) {
              takeOffQueue.dequeue();
              mins = 2;
          }
      }
      else
          mins--;
  
  }
  </code></pre>