Exemplo n.º 1
0
 public ParkSpot(int id)
 {
     Id             = id;
     ParkedVehicles = new ParkedVehicle[3];
     HasMotorcycles = false;
     VehicleCount   = 0;
 }
Exemplo n.º 2
0
 public bool Park(ParkedVehicle vehicle)
 {
     for (var i = 0; i < ParkedVehicles.Length; i++)
     {
         var v = ParkedVehicles[i];
         if (v == null)
         {
             ParkedVehicles[i] = vehicle;
             return(true);
         }
     }
     return(false);
 }
Exemplo n.º 3
0
 public bool Unpark(ParkedVehicle vehicle)
 {
     for (var i = 0; i < ParkedVehicles.Length; i++)
     {
         var v = ParkedVehicles[i];
         if (v != null && v.Equals(vehicle))
         {
             ParkedVehicles[i] = null;
             VehicleCount--;
             return(true);
         }
     }
     return(false);
 }