public CarCatalog(CarFactory carFactory, EngineFactory engineFactory, TireFactory tireFactory) { this.cars = new List <Car>(); this.carFactory = carFactory; this.engineFactory = engineFactory; this.tireFactory = tireFactory; }
public static void Used() { var factory = new TireFactory(); var tireA1 = factory.CreateTire <TireA>(); var tireA2 = factory.CreateTire <TireA>(); var tireB1 = factory.CreateTire <TireA>(); var tireB2 = factory.CreateTire <TireA>(); }
public CarsCatalog(EngineFactory engineFactory, CargoFactory cargoFactory, TireFactory tireFactory, CarFactory carFactory) { this.Cars = new List <Car>(); this.engineFactory = engineFactory; this.cargoFactory = cargoFactory; this.tireFactory = tireFactory; this.carFactory = carFactory; this.dataWrite = new ConsoleWriter(); }
public static void Main(string[] args) { int carsCount = int.Parse(Console.ReadLine()); CarFactory carFactory = new CarFactory(); EngineFactory engineFactory = new EngineFactory(); TireFactory tireFactory = new TireFactory(); CarCatalog carCatalog = new CarCatalog(carFactory, engineFactory, tireFactory); for (int i = 0; i < carsCount; i++) { string[] carArgs = Console.ReadLine().Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries); carCatalog.Add(carArgs); } string command = Console.ReadLine(); carCatalog.GetCarInfo(command); }
public static void Run() { EngineFactory engineFactory = new EngineFactory(); CargoFactory cargoFactory = new CargoFactory(); TireFactory tireFactory = new TireFactory(); CarFactory carFactory = new CarFactory(); ConsoleReader consoleReader = new ConsoleReader(); CarsCatalog cars = new CarsCatalog(engineFactory, cargoFactory, tireFactory, carFactory); int lines = int.Parse(consoleReader.Read()); for (int i = 0; i < lines; i++) { string[] parameters = consoleReader.Read() .Split(" ", StringSplitOptions.RemoveEmptyEntries); cars.Add(parameters); } string command = consoleReader.Read(); cars.GetCarsInfo(command); }