public void processQueue(int time, Simulator sim) throws VehicleException, SimulationException {

		for (int i = 0; i < queue.size(); i++) {
			Vehicle v = queue.get(i);
			if(!(v.isQueued()))
				throw new VehicleException("Vehicle not in correct state");
			if(time > Constants.CLOSING_TIME || time < 0)
				throw new VehicleException("Timing constraints are violated");
			if(!(spacesAvailable(v))){
				// block queue if car can't park
				break;
			}
			else{
				if(!spacesAvailable(v))
					throw new SimulationException("No spaces avaliable");
				// park car at front of queue
				exitQueue(v, time);
				parkVehicle(v, time, sim.setDuration());
				status += setVehicleMsg(v, "Q", "P");
				i--;
			}
		}
	}