Ejemplo n.º 1
0
        static void Main(string[] args)
        {
            Console.WriteLine("Look at a dirty car. If a car is clean you will see 'True'");
            Garage garage = new Garage();
            Car    car1   = new Car("AUDI A6");
            Car    car2   = new Car("BMW X8");
            Car    car3   = new Car("VAZ 3310");

            garage.Add(car1);
            garage.Add(car2);
            garage.Add(car3);
            foreach (var car in garage)
            {
                Console.WriteLine(car.name + " " + car.clean);
            }

            Console.WriteLine("Lets wash all our cars. If car is clean you will see 'True'");
            foreach (var car in garage)
            {
                Washer washer = new Washer();
                Wash   del    = washer.Wash;
                del(car);
                Console.WriteLine(car.name + " " + car.clean);
            }
        }
Ejemplo n.º 2
0
        static void Main(string[] args)
        {
            Console.WriteLine("Список брудних машин. Якщо машина буде чистою ви побачите вiдмiтку 'True'");
            Garage garage = new Garage();
            Car    car1   = new Car("Geely");
            Car    car2   = new Car("Chery");
            Car    car3   = new Car("Toyota");
            Car    car4   = new Car("Bugatti");

            garage.Add(car1);
            garage.Add(car2);
            garage.Add(car3);
            garage.Add(car4);
            foreach (var car in garage)
            {
                Console.WriteLine(car.name + " " + car.clean);
            }
            Console.WriteLine("Якщо машина пiсля мийки буде чистою ви побачите вiдмiтку 'True'");
            foreach (var car in garage)
            {
                Washer washer = new Washer();
                W      del    = washer.Wash;
                del(car);
                Console.WriteLine(car.name + " " + car.clean);
            }
            Console.ReadKey();
        }
Ejemplo n.º 3
0
        static void Main(string[] args)
        {
            Console.WriteLine("Look at a dirty car. If a car is clean you will see 'True'");
            Garage garage = new Garage();
            Car    car1   = new Car("Geely Emgrand 7");
            Car    car2   = new Car("Honda Civic");
            Car    car3   = new Car("Subaru Impreza");

            garage.Add(car1);
            garage.Add(car2);
            garage.Add(car3);
            foreach (var car in garage)
            {
                Console.WriteLine(car.name + " " + car.clean);
            }

            Console.WriteLine("Lets wash all our cars. If car is clean you will see 'True'");
            foreach (var car in garage)
            {
                Washer washer = new Washer();
                Wash   del    = washer.Wash;
                del(car);
                Console.WriteLine(car.name + " " + car.clean);
            }
        }
Ejemplo n.º 4
0
        static void Main(string[] args)
        {
            Console.WriteLine("-------------------------------------------------------");
            Garage garage = new Garage();
            Car    car1   = new Car("Tesla Model X");
            Car    car2   = new Car("BMW X6 M");
            Car    car3   = new Car("Ford Mustang GT");

            garage.Add(car1);
            garage.Add(car2);
            garage.Add(car3);
            foreach (var car in garage)
            {
                Console.WriteLine(car.name + " |is clean?|  " + car.clean);
            }
            Console.WriteLine("-------------------------------------------------------");
            Console.WriteLine("Пiсля автомийки:");
            foreach (var car in garage)
            {
                Washer washer = new Washer();
                Wash   del    = washer.Wash;
                del(car);
                Console.WriteLine(car.name + "  |is clean?|  " + car.clean);
            }
            Console.ReadKey();
        }
Ejemplo n.º 5
0
        static void Main(string[] args)
        {
            Car        Opel      = new Car("Opel");
            Car        Mazda     = new Car("Mazda");
            Car        Mercedes  = new Car("Mercedes");
            Car        Volvo     = new Car("Volvo");
            Car        Audi      = new Car("Audi");
            Garage     garage    = new Garage();
            Washer     CarWash   = new Washer();
            List <Car> listCarov = new List <Car> {
                Opel, Mazda, Mercedes, Volvo, Audi
            };

            garage.addCars(listCarov);
            CarWash.Wash(garage);
            Console.ReadKey();
        }
Ejemplo n.º 6
0
        static void Main(string[] args)
        {
            Garage garage = new Garage();
            Car    car1   = new Car("mazda");
            Car    car2   = new Car("BMW");
            Car    car3   = new Car("Toyota");

            garage.Add(car1);
            garage.Add(car2);
            garage.Add(car3);
            foreach (var car in garage)
            {
                Console.WriteLine(car.name + " " + car.clean);
            }
            Console.WriteLine("");
            foreach (var car in garage)
            {
                Washer washer = new Washer();
                Wa     del    = washer.Wash;
                del(car);
                Console.WriteLine(car.name + " " + car.clean);
            }
            Console.ReadKey();
        }
Ejemplo n.º 7
0
        static void Main(string[] args)
        {
            Garage garage = new Garage();
            Car    car1   = new Car("Renault");
            Car    car2   = new Car("Skoda");
            Car    car3   = new Car("Porshe", true);
            Car    car4   = new Car("Cadillac");
            Car    car5   = new Car("Bentley");

            garage.Add(car1);
            garage.Add(car2);
            garage.Add(car3);
            garage.Add(car4);
            garage.Add(car5);

            Console.WriteLine("Список машин та статус очистки.");
            Console.WriteLine();

            foreach (var index in garage)
            {
                Console.WriteLine(index);
            }
            Console.WriteLine();
            Console.WriteLine("Чистка...");
            Console.WriteLine();

            Washer       washer      = new Washer();
            WashDelegate washMachine = washer.Wash;

            foreach (var car in garage)
            {
                washMachine(car);
                Console.WriteLine(car);
            }
            Console.ReadKey();
        }