Exemplo n.º 1
0
        public void BuildaCar(CarOrderForm form)
        {
            _engine.EngineType(form.EngineType);

            if (form.UpgradeToSuperchargeEngine)
            {
                _engine.SuperchargeUpgrade();
            }

            Console.WriteLine("");
            _tires.TireStyle(form.TireStyle);

            Console.WriteLine("");
            Console.WriteLine("Accessories & Upgrade Options:");
            Console.WriteLine("----------------------------------------------");

            if (form.AirbagUpgrade)
            {
                _accessories.AirbagUpgrade();
            }

            if (form.BluetoothUpgrade)
            {
                _accessories.UpgradeToBluetoothRadio();
            }

            if (form.FiveYearMaintenance)
            {
                _accessories.FiveYearMaintenance();
            }

            if (form.SeatWarmerUpgrade)
            {
                _accessories.SeatWarmerUpgrade();
            }

            if (form.SunroofUpgrade)
            {
                _accessories.SunroofUpgrade();
            }

            Console.WriteLine("");
            Console.WriteLine("----------------------------------------------");
            Console.WriteLine("Thank You for your business. =)");
            Console.WriteLine("----------------------------------------------");
        }
Exemplo n.º 2
0
        static void Main(string[] args)
        {
            var car = new CarFacade();

            var form = new CarOrderForm
            {
                AirbagUpgrade = true,
                BluetoothUpgrade = true,
                EngineType = "V4",
                FiveYearMaintenance = true,
                SunroofUpgrade = false,
                SeatWarmerUpgrade = false,
                TireStyle = "All Season",
                UpgradeToSuperchargeEngine = false
            };

            car.BuildaCar(form);

            // Wait for user
            Console.ReadKey();
        }