Exemple #1
0
        static void Main(string[] args)
        {
            Vehicle vehicle = new Vehicle();
            vehicle.Name = "Porcshe";
            vehicle.Model = "911";

            Tyre tyre = new Tyre();
            tyre.Name = "Nokia";
            tyre.Model = "Hakkapeliitta";
            tyre.Size = "105R5";

            for (int l=0;l<4;l++)
                vehicle.AddTyre(tyre);

            Console.WriteLine(vehicle.ToString());
            Console.Read();
        }
Exemple #2
0
        static void Main(string[] args)
        {
            //Creati tyre
            Tyre tyre = new Tyre { Name = "Nokia", Model = "Hakka", TyreSize = "205R16" };

            //Create a car
            Vehicle car = new Vehicle { Name = "Porche", Model = "911" };
            car.AddTyre(tyre); // car contains tyres
            car.AddTyre(tyre); // car contains tyres
            car.AddTyre(tyre); // car contains tyres
            car.AddTyre(tyre); // car contains tyres

            Console.WriteLine(car.ToString());

            Console.WriteLine("Press enter to continue...");
            Console.ReadLine();
        }
Exemple #3
0
        static void Main(string[] args)
        {
            Tyre tyre1 = new Tyre { Name = " Black Pirelli FRONT ", Model = " Round ", Size = " 20SR16 " };
            Tyre tyre2 = new Tyre { Name = " Black Pirelli REAR ", Model = " Round ", Size = " 22SR16 " };
            Tyre tyre3 = new Tyre { Name = " Gummid ", Model = " Uudet ", Size = " Bemmi " };
            Vehicle car = new Vehicle { Name = "Ford ", Model = "Focus Wagon " };
            car.AddTyre(tyre1); // car contains tyres
            car.AddTyre(tyre1);
            car.AddTyre(tyre2);
            car.AddTyre(tyre2);

            Vehicle bemari = new Vehicle { Name = "BMW ", Model = "amis bemmi " };
            bemari.AddTyre(tyre3);
            bemari.AddTyre(tyre3);
            bemari.AddTyre(tyre3);
            bemari.AddTyre(tyre3);


            Console.WriteLine(car.ToString());
            Console.WriteLine(bemari.ToString());
            Console.WriteLine("Press any key...");
            Console.ReadLine();

        }