public class ParkingSystem { Dictionary<int, int> _parkSlots = new Dictionary<int, int>(); public ParkingSystem(int big, int medium, int small) { _parkSlots[1] = big; _parkSlots[2] = medium; _parkSlots[3] = small; } public bool AddCar(int carType) { if (_parkSlots[carType] > 0) { --_parkSlots[carType]; return true; } return false; } }
No comments:
Post a Comment