Exemplo n.º 1
0
        public void bookSlot(string type, string number, bool advanced)
        {
            int i, spot, count;

            for (i = 0; i < this.floors; i++)
            {
                spot = levels[i].GetSpot(type);
                if (spot != -1)
                {
                    count = getStatus(visited);
                    ParkedVehicle parked = new ParkedVehicle(type, number, i + 1, spot + 1, advanced);
                    Console.WriteLine("Your parking spot is {0} floor and {1} spot", parked.floors, parked.spots);
                    Console.WriteLine("Welcome sir");
                    parked.visited = count;
                    pv.Add(parked);
                    for (int j = 0; j < floors; j++)
                    {
                        Console.WriteLine("Floor" + (j + 1));
                        levels[j].printf();
                    }
                    break;
                }
                else
                {
                    Console.WriteLine("Sorry there is no house for your {0}", type);
                    break;
                }
            }
        }
Exemplo n.º 2
0
 private void freeSpace(ParkedVehicle p, string type)
 {
     if (type == "bike")
     {
         levels[p.floors - 1].bikeSpot[p.spots - 1] = 0;
     }
     else if (type == "car")
     {
         levels[p.floors - 1].carSpot[p.spots - 1] = 0;
     }
     else
     {
         levels[p.floors - 1].busSpot[p.spots - 1] = 0;
     }
 }