public static ParkSpot[] ParkOnMultipleSpots(int startOfSpotSequence, int spotSequenceLength, ParkedVehicle vehicle) { var spots = new ParkSpot[spotSequenceLength]; var n = 0; for (var i = startOfSpotSequence; i < startOfSpotSequence + spotSequenceLength; i++) { parkSpots[i].Park(vehicle); parkSpots[i].VehicleCount = 1; spots[n] = parkSpots[i]; n++; } return(spots); }
public static bool SpotIsAvailable(ParkSpot spot, bool forMotorcycle) { if (spot == null || spot.VehicleCount == 0 || (forMotorcycle && spot.HasMotorcycles && spot.VehicleCount < 3)) { if (spot == null) { spot = new ParkSpot(nextSpotId); parkSpots[nextSpotId] = spot; nextSpotId++; } AvailableSpot = spot; return(true); } else { return(false); } }