Exemple #1
0
        static void Main(string[] args)
        {
            // Create shop with vehicle builders
            VehicleBuilder builder;

            Shop shop = new Shop();

            // Construct and display vehicles

            builder = new ScooterBuilder();
            shop.Construct(builder);
            builder.Vehicle.Show();

            builder = new CarBuilder();
            shop.Construct(builder);
            builder.Vehicle.Show();

            builder = new MotorCycleBuilder();
            shop.Construct(builder);
            builder.Vehicle.Show();

            // Wait for user

            Console.ReadKey();
        }
Exemple #2
0
        static void Main(string[] args)
        {
            VehicleBuilder builder = null;

            // Create Shop with Vehilce Builder
            Shop shop = new Shop();


            // Construct and build Vehicle
            Console.WriteLine("Please enter the no of the vehicle you want to make from the following list.");
            System.Console.WriteLine("========================================================");
            System.Console.WriteLine("1. Car, 2. MotorCycle, 3. ScooterBuilder");
            System.Console.WriteLine("========================================================");
            int vehicleType = Convert.ToInt16(Console.ReadLine());

            if (vehicleType == 1)
            {
                builder = new CarBuilder();
            }
            else if (vehicleType == 2)
            {
                builder = new MotorCycleBuilder();
            }
            else if (vehicleType == 3)
            {
                builder = new ScooterBuilder();
            }
            else
            {
                Console.WriteLine("Incorrect Vehicle Type entered...!");
            }

            shop.Build(builder);
            builder.Vehicle.Show();
        }
        private static void Main()
        {
            VehicleBuilder builder;


            Shop shop = new Shop();


            builder = new ScooterBuilder();
            shop.Construct(builder);
            builder.Vehicle.Show();

            builder = new CarBuilder();
            shop.Construct(builder);
            builder.Vehicle.Show();

            builder = new MotorCycleBuilder();
            shop.Construct(builder);
            builder.Vehicle.Show();
        }