Executing a section of code every x minutes
<p>I need to make add a "car" to the queue every 2 minutes, and remove a "car" from the queue every 2 minutes. Then when possible move the cars from the stack into the queue when the queue opens up in the same increments of time.</p>

<pre><code>public static void main(String[] args) {

    int lp = 10000;  
    int i = 10;       
    int maxQueue = 0;
    int maxStack = 0;
    Lstack stack = new Lstack();
    Lqueue queue = new Lqueue();
    int cr = 1; //cars removed

    Scanner input = new Scanner(System.in);

    for (int size = 0; size &lt; 26; size++) {


        **// arrivals, need to add 2 min wait**           
        if (maxQueue &lt; 6 ){                        
        Car car = new Car(Integer.toString(lp), 'X');            
        queue.insert(car);
        lp = lp + i;
        maxQueue++;
    }     

    else if (maxQueue &gt; 6){ 
       Car car = new Car(Integer.toString(lp), 'X');
       stack.push(car);
       lp = lp + i;
       maxStack++;
    }

    else if((maxQueue &gt; 6) &amp;&amp; (maxStack &gt; 6)){
       System.out.println("Sorry there isn't enough room");
       cr++;
       System.out.println("New amount to be taken away:" + cr);
    }    

      **// removals, need to add the wait 5 min**
        if (maxQueue != 0){            
        for(i = 0; i &lt; cr; i++){
            queue.remove();
            System.out.println("Car" + lp + "was/were removed");
        }            
        maxQueue--;
        }

        else if( maxQueue == 0){
            cr++;
        }
        System.out.println("Before Driveway Moves:");
        queue.display();
        stack.display();

        // empty driveway

        while((maxQueue &lt; 6) &amp;&amp; (maxStack != 0)){
           System.out.println("Moving car " + lp + " to the driveway");
            queue.insert(stack.pop());
        }
        System.out.println("After Driveway Moves: ");
        queue.display();
        stack.display();

    }
}
</code></pre>
