예제 #1
0
        static void Main(string[] args)
        {
            //Elimizdeki nesneyi farklı koşullarda, farklı anlamlar yükleyerek kullanmak için bu desen tercih edilir.
            var personelCar = new PersonalCar {
                Make = "BMW", Model = "3.20", HirePrice = 3000
            };
            var commercialCar = new CommercialCar {
                Make = "Ford", Model = "Transit", HirePrice = 2000
            };

            SpecialOffer specialOfferPersonal = new SpecialOffer(personelCar);

            specialOfferPersonal.DiscountPercentage = 10;

            SpecialOffer specialOfferCommercial = new SpecialOffer(commercialCar);

            specialOfferCommercial.DiscountPercentage = 20;

            Console.WriteLine("Gerçek Fiyat ({1} {2}): {0}", personelCar.HirePrice, personelCar.Make, personelCar.Model);
            Console.WriteLine("İndirimli Fiyat ({1} {2}): {0}", specialOfferPersonal.HirePrice, personelCar.Make, personelCar.Model);
            Console.WriteLine("-------------------------------------------------------");
            Console.WriteLine("Gerçek Fiyat ({1} {2}): {0}", commercialCar.HirePrice, commercialCar.Make, commercialCar.Model);
            Console.WriteLine("İndirimli Fiyat ({1} {2}): {0}", specialOfferCommercial.HirePrice, commercialCar.Make, commercialCar.Model);
            Console.ReadLine();
        }
        static void Main(string[] args)
        {
            // Basic vehicle
            Ferrari360 car = new Ferrari360();

            Console.WriteLine("Base price is {0:c} for {1} laps.", car.HirePrice, car.HireLaps);

            // Special offer
            SpecialOffer offer = new SpecialOffer(car);

            offer.DiscountPercentage = 25;
            offer.ExtraLaps          = 2;

            Console.WriteLine("Offer price is {0:c} for {1} laps.", offer.HirePrice, offer.HireLaps);

            // Hire for basic vehicle
            Hireable hire1 = new Hireable(car);

            hire1.Hire("Bob");

            // Hire for vehicle with special offer
            Hireable hire2 = new Hireable(offer);

            hire2.Hire("Bill");

            Console.Read();
        }
예제 #3
0
        static void Main(string[] args)
        {
            PersonalCar personalCar = new PersonalCar {
                Make = "Bmw", Model = "5.20", HirePrice = 3000
            };

            Console.WriteLine(personalCar.HirePrice);
            SpecialOffer specialOffer = new SpecialOffer(personalCar);

            Console.WriteLine(specialOffer.HirePrice);
        }
예제 #4
0
        static void Main(string[] args)
        {
            var personalCar = new PersonalCar {
                Make = "BMW", Model = "3.20", HidePrice = 2500
            };
            SpecialOffer specialOffer = new SpecialOffer(personalCar);

            specialOffer.DiscountPercentage = 10;
            Console.WriteLine("SpecialOffer: {0}", specialOffer.HidePrice);
            Console.WriteLine("Personal Car: {0}", personalCar.HidePrice);
        }
예제 #5
0
        static void Main(string[] args)
        {
            var personalCar = new PersonalCar {
                Make = "bmw", Model = "3.20", HirePrice = 2500
            };
            SpecialOffer specialOffer = new SpecialOffer(personalCar);

            specialOffer.DiscountPercentage = 10;
            System.Console.WriteLine("Concrete : {0}", personalCar.HirePrice);
            System.Console.WriteLine("SpecialOffer : {0}", specialOffer.HirePrice);
        }
예제 #6
0
        static void Main(string[] args)
        {
            PersonalCar personalCar = new PersonalCar {
                Make = "BMW", Model = "3.20i", HirePrice = 2500
            };
            SpecialOffer specialOffer = new SpecialOffer(personalCar, 10);

            Console.WriteLine("Normal Hire Price: {0}", personalCar.HirePrice);
            Console.WriteLine("Special Offer Hire Price: {0}", specialOffer.HirePrice);

            Console.ReadLine();
        }
예제 #7
0
        static void Main(string[] args)
        {
            var personalCar = new PersonalCar {
                Brand = "Honda", Model = "Civic", HirePrice = 1000
            };
            SpecialOffer specialOffer = new SpecialOffer(personalCar);

            specialOffer.DiscontPercentage = 10;

            Console.WriteLine("Personal Car : {0} ", personalCar.HirePrice);
            Console.WriteLine("Special Offer : {0} ", specialOffer.HirePrice);
        }
예제 #8
0
        static void Main(string[] args)
        {
            var personelCar = new PersonelCar {
                Make = "BMW", Model = "3.20,", HirePrice = 2500
            };
            var specialOffer = new SpecialOffer(personelCar);

            Console.WriteLine("Concrete {0}", personelCar.HirePrice);
            Console.WriteLine("Special Offer {0}", specialOffer.HirePrice);

            Console.ReadLine();
        }
예제 #9
0
        //Let's assume we have a car rental company. we want to offer special discounts for some customers
        //During some periods. This pattern can be used for these conditions.
        static void Main(string[] args)
        {
            var personelCar = new PersonalCar {
                Make = "BMW", Model = "3.20", HirePrice = 2500
            };
            SpecialOffer specialOffer = new SpecialOffer(personelCar);

            specialOffer.DiscountPercentage = 90;
            Console.WriteLine(personelCar.HirePrice);
            Console.WriteLine(specialOffer.HirePrice);

            Console.ReadLine();
        }
예제 #10
0
        static void Main(string[] args)
        {
            var personalCar = new PersonalCar {
                Make = "BMW", Model = "3.2", HirePrice = 10000
            };

            SpecialOffer special = new SpecialOffer(personalCar);

            special.Discount = 10;

            Console.WriteLine("Price: {0}", personalCar.HirePrice);
            Console.WriteLine("Special Price: {0}", special.HirePrice);
        }
예제 #11
0
        static void Main(string[] args)
        {
            var personalCar = new PersonalCar {
                HirePrice = 2500, Make = "BMW", Model = "3.20"
            };
            SpecialOffer specialOffer = new SpecialOffer(personalCar);

            specialOffer.DiscountPercentage = 10;
            Console.WriteLine($"Concreate : {personalCar.HirePrice}");

            Console.WriteLine($"Special Offer : {specialOffer.HirePrice}");

            Console.ReadLine();
        }
예제 #12
0
        static void Main(string[] args)
        {
            CarBase personalCar = new PersonalCar()
            {
                Make = "BMW", Model = "3.20", HirePrice = 2500
            };
            SpecialOffer specialOffer = new SpecialOffer(personalCar);

            Console.WriteLine("Kiralama bedeli: {0}", personalCar.HirePrice);
            specialOffer.DiscountPercentage = 10;       //%10 indirim
            Console.WriteLine("İndirimli Kiralama bedeli: {0}", specialOffer.HirePrice);

            Console.ReadKey();
        }
예제 #13
0
        static void Main(string[] args)
        {
            Honda car = new Honda();

            Console.WriteLine("Honda base price is: {0}", car.Price);

            SpecialOffer offer = new SpecialOffer(car);

            offer.DiscountPercentage = 25;
            offer.Offer = "25% discount";

            Console.WriteLine("{1} @ Diwali Special Offer and price is : {0}", offer.Price, offer.Offer);

            Console.ReadKey();
        }
예제 #14
0
        static void Main(string[] args)
        {
            var personelCar = new PersonalCar {
                Make = "polo", Model = "1.4", HirePrice = 200
            };

            SpecialOffer specialOffer = new SpecialOffer(personelCar);

            specialOffer.DiscountPercentage = 10;

            Console.WriteLine("concrete: {0}", personelCar.HirePrice);
            Console.WriteLine("special offer: {0}", specialOffer.HirePrice);

            Console.ReadLine();
        }
예제 #15
0
        static void Main(string[] args)
        {
            CarBase personelCar = new PersonalCar()
            {
                Make = "Citroen", Model = "C3", HirePrice = 100
            };

            SpecialOffer specialOffer = new SpecialOffer(personelCar);

            specialOffer.DiscountPercentage = 10;

            Console.WriteLine("Special Offer: Make: {0}, Model:{1}, HirePrice: {2}", specialOffer.Make, specialOffer.Model, specialOffer.HirePrice);

            Console.Read();
        }
예제 #16
0
        static void Main(string[] args)
        {
            var personelCar = new PersonalCar
            {
                Make      = "Mercedes",
                Model     = "E",
                HirePrice = 95000
            };

            SpecialOffer specialOffer = new SpecialOffer(personelCar);

            specialOffer.DiscountPercentage = 20;
            Console.WriteLine("Concrete  : {0}", personelCar.HirePrice);
            Console.WriteLine("Special Offer : {0}", specialOffer.HirePrice);
        }
예제 #17
0
        static void Main(string[] args)
        {
            var personalCar = new PersonalCar {
                Make = "BMW", Model = "3,20", HirePrice = 2500
            };                                                                                   //bu normal fiyatlar

            SpecialOffer specialOffer = new SpecialOffer(personalCar);

            specialOffer.DiscountPercentage = 10; //özel teklife özellik yazdığımızda burda set etmemiz gerek

            Console.WriteLine("Concrete : {0}", personalCar.HirePrice);
            Console.WriteLine("Special Offer : {0}", specialOffer.HirePrice);

            Console.ReadLine();
        }
예제 #18
0
        static void Main(string[] args)
        {
            var personelCar = new PersonelCar
            {
                Make      = "BMW",
                Model     = "3.20",
                HirePrice = 2500
            };
            SpecialOffer specialOffer = new SpecialOffer(personelCar);

            specialOffer.DiscountPercentage = 20;

            Console.WriteLine("Concrete : " + personelCar.HirePrice);
            Console.WriteLine("Special offer : " + specialOffer.HirePrice);
            Console.ReadKey();
        }
예제 #19
0
        static void Main(string[] args)
        {
            var personalCar = new PersonalCar {
                Make = "Hyundai", Model = "i20", HirePrice = 2100
            };

            SpecialOffer specialOffer = new SpecialOffer(personalCar);

            specialOffer.DiscountPercantage = 10;


            Console.WriteLine("Concrete : {0}", personalCar.HirePrice);
            Console.WriteLine("Special offer : {0}", specialOffer.HirePrice);

            Console.ReadLine();
        }
예제 #20
0
        static void Main(string[] args)
        {
            // Basic vehicle
            HondaCity car = new HondaCity();

            Console.WriteLine("Honda City base price are : {0}", car.Price);

            // Special offer
            SpecialOffer offer = new SpecialOffer(car);

            offer.DiscountPercentage = 25;
            offer.Offer = "25 % discount";

            Console.WriteLine("{1} @ Christmas Special Offer and price are : {0} ", offer.Price, offer.Offer);

            Console.ReadKey();
        }
예제 #21
0
        static void Main(string[] args)
        {
            //farklı ürünlerin farklı zamanlarda farklı şekilde kullanılması durumudur.
            //kişiye özel indirimler fiyatlandırmalar örneklendirebilir.

            var personalCar = new PersonalCar {
                Make = "BMW", Model = "3.20", HirePrice = 2500
            };
            SpecialOffer specialOffer = new SpecialOffer(personalCar);

            specialOffer.DiscountPercentage = 10;

            Console.WriteLine("Concrete: {0}", personalCar.HirePrice);
            Console.WriteLine("Special Offer: {0}", specialOffer.HirePrice);

            Console.ReadLine();
        }
예제 #22
0
        static void Main(string[] args)
        {
            // temel bir nesneye farklı koşullarda daha farklı anlamlar  yüklemek için kullanılan design patterndir.

            var personalCar = new PersonalCar()
            {
                Make = "BMW", Model = "3.20d", HirePrice = 2500
            };

            SpecialOffer specialOffer = new SpecialOffer(personalCar);

            specialOffer.DisCountPercentage = 10;
            Console.WriteLine("Concrete : " + personalCar.HirePrice);
            Console.WriteLine("special offer : " + specialOffer.HirePrice);


            Console.ReadLine();
        }
예제 #23
0
        /// <summary>
        /// senaryo
        /// bilgisayar mağazası uygulamamız var
        /// özel ödeme yöntemi dekore edildiğinde ürün yüzde 10 indirimli oluyor
        ///
        /// </summary>
        /// <param name="args"></param>
        public static void Main(string[] args)
        {
            Console.WriteLine("");

            PCBase pC = new PersonPC {
                Brand = "lenovo", Model = "A550", Price = 4500
            };
            SpecialOffer special = new SpecialOffer(pC);

            Console.WriteLine("normal ödeme");

            Console.WriteLine(pC.Price.ToString());

            Console.WriteLine("özel ödeme");
            Console.WriteLine(special.Price.ToString());

            Console.ReadKey();
        }