示例#1
0
 public CarSalesman(CarFactory carFactory, EngineFactory engineFactory)
 {
     this.cars          = new List <Car>();
     this.engines       = new List <Engine>();
     this.carFactory    = carFactory;
     this.engineFactory = engineFactory;
 }
 public CarSalesman()
 {
     this.engineFactory = new EngineFactory();
     this.carFactory    = new CarFactory();
     this.engineCatalog = new EngineCatalog();
     this.carCatalog    = new CarCatalog();
 }
示例#3
0
        public static void Main()
        {
            CarFactory    carFactory    = new CarFactory();
            CarCatalog    cars          = new CarCatalog();
            EngineFactory engineFactory = new EngineFactory();
            EngineCatalog engines       = new EngineCatalog();
            int           engineCount   = int.Parse(Console.ReadLine());

            for (int i = 0; i < engineCount; i++)
            {
                string[] parameters = Console.ReadLine().Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
                engines.Add(engineFactory.Create(parameters));
            }

            int carCount = int.Parse(Console.ReadLine());

            for (int i = 0; i < carCount; i++)
            {
                string[] parameters = Console.ReadLine().Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
                cars.Add(carFactory.Create(engines, parameters));
            }

            foreach (var car in cars)
            {
                Console.WriteLine(car);
            }
        }
示例#4
0
        static void Main(string[] args)
        {
            CarFactory    carFactory    = new CarFactory();
            EngineFactory engineFactory = new EngineFactory();
            CarSalesman   carSalesman   = new CarSalesman(carFactory, engineFactory);

            int engineCount = int.Parse(Console.ReadLine());

            for (int i = 0; i < engineCount; i++)
            {
                string[] parameters = Console.ReadLine().Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
                carSalesman.AddEngine(parameters);
            }

            int carCount = int.Parse(Console.ReadLine());

            for (int i = 0; i < carCount; i++)
            {
                string[] parameters = Console.ReadLine().Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
                carSalesman.AddCar(parameters);
            }

            foreach (var car in carSalesman.getCars())
            {
                Console.WriteLine(car);
            }
        }
示例#5
0
        static void Main(string[] args)
        {
            EngineFactory newEngineFactory = new EngineFactory();
            CarFactory    newCarFactory    = new CarFactory();

            int engineCount = int.Parse(Console.ReadLine());

            for (int i = 0; i < engineCount; i++)
            {
                string[] parameters = Console.ReadLine()
                                      .Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
                newEngineFactory.Add(parameters);
            }

            int carCount = int.Parse(Console.ReadLine());

            for (int i = 0; i < carCount; i++)
            {
                string[] parameters = Console.ReadLine()
                                      .Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
                newCarFactory.Add(parameters, newEngineFactory);
            }

            Printing(newCarFactory);
        }
示例#6
0
 private static void Printing(CarFactory newCarFactory)
 {
     foreach (var car in newCarFactory.cars)
     {
         Console.WriteLine(car);
     }
 }
示例#7
0
        public static void Main()
        {
            var carCatalogue    = new CarCatalogue();
            var engineCatalogue = new EngineCatalogue();

            int engineCount = int.Parse(Console.ReadLine());

            for (int i = 0; i < engineCount; i++)
            {
                string[] parameters = Console.ReadLine().Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);

                var engineFactory = new EngineFactory(parameters);
                var newEngine     = engineFactory.Create();

                engineCatalogue.Add(newEngine);
            }

            int carCount = int.Parse(Console.ReadLine());

            for (int i = 0; i < carCount; i++)
            {
                string[] parameters = Console.ReadLine().Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);

                var carFactory = new CarFactory(parameters, engineCatalogue);
                var newCar     = carFactory.Create();

                carCatalogue.Add(newCar);
            }

            foreach (var car in carCatalogue.GetAllCars())
            {
                Console.WriteLine(car);
            }
        }
示例#8
0
        public static void Main()
        {
            CarFactory    carFactory    = new CarFactory();
            EngineFactory engineFactory = new EngineFactory();

            CarSalesman carSalesman = new CarSalesman(carFactory, engineFactory);

            var engineCount = int.Parse(Console.ReadLine());

            for (int i = 0; i < engineCount; i++)
            {
                var parameters = Console.ReadLine()
                                 .Split(' ', StringSplitOptions.RemoveEmptyEntries);

                carSalesman.AddEngine(parameters);
            }

            var carCount = int.Parse(Console.ReadLine());

            for (int i = 0; i < carCount; i++)
            {
                var parameters = Console.ReadLine()
                                 .Split(' ', StringSplitOptions.RemoveEmptyEntries);

                carSalesman.AddCar(parameters);
            }

            foreach (var car in carSalesman.GetCars())
            {
                Console.WriteLine(car);
            }
        }
示例#9
0
        public static void CarCreator(int carCount)
        {
            for (int i = 0; i < carCount; i++)
            {
                string[] parameters = Console.ReadLine().Split(new[] { ' ' }
                                                               , StringSplitOptions.RemoveEmptyEntries);

                CarFactory.CreateCar(parameters);
            }
        }
示例#10
0
        static void Main(string[] args)
        {
            int engineCount = int.Parse(Console.ReadLine());

            CarSalesman.EngineCreator(engineCount);

            int carCount = int.Parse(Console.ReadLine());

            CarSalesman.CarCreator(carCount);

            foreach (var car in CarFactory.GetCar())
            {
                Console.WriteLine(car);
            }
        }