Пример #1
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);
            }
        }
Пример #2
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);
            }
        }
Пример #3
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);
            }
        }
 public Runner(CarSalesman carSalesman)
 {
     this.carSalesman = carSalesman;
 }