예제 #1
0
        public void Add(string[] parameters)
        {
            CarFactory carfactory = new CarFactory();
            Car        car        = carfactory.Create(parameters);

            cars.Add(car);
        }
예제 #2
0
        public void Add(string[] parameters)
        {
            string model       = parameters[0];
            int    engineSpeed = int.Parse(parameters[1]);
            int    enginePower = int.Parse(parameters[2]);
            int    cargoWeight = int.Parse(parameters[3]);
            string cargoType   = parameters[4];

            Engine engine = engineFactory.Create(engineSpeed, enginePower);
            Cargo  cargo  = cargoFactory.Create(cargoWeight, cargoType);

            Tire[] tires = GetTires(parameters.Skip(5).ToList());
            Car    car   = carFactory.Create(model, engine, cargo, tires);

            cars.Add(car);
        }