示例#1
0
 public Truck(int Number, EnumTruckType TruckType, string DriverName, string LicenseNo)
 {
     this.Number     = Number;
     this.TruckType  = TruckType;
     this.DriverName = DriverName;
     this.LicenseNo  = LicenseNo;
     if (TruckType == EnumTruckType.Class4)
     {
         _Capacity = 2500;
     }
     if (TruckType == EnumTruckType.Class5)
     {
         _Capacity = 3000;
     }
     if (TruckType == EnumTruckType.Class6)
     {
         _Capacity = 3500;
     }
     if (TruckType == EnumTruckType.Class7)
     {
         _Capacity = 4000;
     }
     if (TruckType == EnumTruckType.Class8)
     {
         _Capacity = 5500;
     }
     if (TruckType == EnumTruckType.Class9)
     {
         _Capacity = 7500;
     }
 }
示例#2
0
        public void Add(int Number, EnumTruckType TruckType, string DriverName, string LicenseNo)
        {
            if (Trucks.Count == _VehicleCount)
            {
                throw new Exception("Maximum trucks available is " + _VehicleCount.ToString() + ".");
            }
            Truck T = new Truck(Number, TruckType, DriverName, LicenseNo);

            Trucks.Add(T.Capacity + (float)Number / 100.0f, T);
        }