Example #1
0
        static void Main(string[] args)
        {
            Product prt1 = new Product();

            prt1.ID          = 12;
            prt1.Name        = "Phone";
            prt1.Discription = "Smart";

            Product prt2 = new Product(17, "PC", "Gaming");

            Product prt3 = new Product {
                ID = 33, Name = "Mouse", Discription = "RGB"
            };

            Product[] Allproduct = new Product[] { prt1, prt2, prt3 };

            SepetManager SptMng = new SepetManager();

            SptMng.Add(prt1);
            SptMng.Add(prt2);
            SptMng.Add(prt3);
        }
Example #2
0
        static void Main(string[] args)
        {
            Product product1 = new Product();

            product1.Adi      = "Elma";
            product1.Fiyati   = 10;
            product1.Aciklama = "Amasya elmasi";


            Product product2 = new Product();

            product2.Adi      = "Karpuz";
            product2.Fiyati   = 15;
            product2.Aciklama = "Diyarbakir karpuzu";

            Product[] products = new Product[] { product1, product2 };

            foreach (Product productItem in products)
            {
                Console.WriteLine(productItem.Adi);
                Console.WriteLine(productItem.Fiyati);
                Console.WriteLine(productItem.Aciklama);
                Console.WriteLine("---------------------");
            }

            Console.WriteLine("-----------Metotlar-----------");

            //instance oluşturma - class örneği

            //encapsulation yapılmış
            SepetManager sepetManager = new SepetManager();

            sepetManager.Ekle(product1);
            sepetManager.Ekle(product2);
            //encapsulation yapılmamış
            sepetManager.Ekle2("Armut", "Yesil armut", 12, 10);
            sepetManager.Ekle2("Elma", "Yesil elma", 12, 9);
            sepetManager.Ekle2("Karpuz", "Diyarbakır karpuzu", 12, 8);
        }
Example #3
0
        static void Main(string[] args)
        {
            Product prod1 = new Product();

            prod1.Name        = "Elma";
            prod1.Price       = 15;
            prod1.Description = "Amasya Elması";

            Product prod2 = new Product();

            prod2.Name        = "Karpuz";
            prod2.Price       = 80;
            prod2.Description = "Diyarbakır Karpuzu";

            Product[] products = new Product[] { prod1, prod2 };


            foreach (Product product in products)
            {
                Console.WriteLine(product.Name);
                Console.WriteLine(product.Price);
                Console.WriteLine(product.Description);
                Console.WriteLine("-------------");
            }

            Console.WriteLine("--------------Methods---------------");
            //instance
            //encapsulation
            SepetManager sepetManager = new SepetManager();

            sepetManager.Add(prod1);
            sepetManager.Add(prod2);



            sepetManager.Add2("Armut", "Yeşil Armut", 12, 58);
            sepetManager.Add2("Elma", "Yeşil Elma", 12, 85);
            sepetManager.Add2("Karpuz", "Diyarbakır Karpuzu", 20, 15);
        }
Example #4
0
        static void Main(string[] args)
        {
            Product product1 = new Product();

            product1.Adi      = "Elma";
            product1.Fiyati   = 15;
            product1.Aciklama = "Amasya Elması";

            Product product2 = new Product();

            product2.Adi      = "Karpuz";
            product2.Fiyati   = 80;
            product2.Aciklama = "Diyarbakır Karpuzu";

            Product[] products = new Product[] { product1, product2 };
            //type-safe
            foreach (Product product in products)
            {
                Console.WriteLine(product.Adi);
                Console.WriteLine(product.Fiyati);
                Console.WriteLine(product.Aciklama);
                Console.WriteLine("---------------------------");
            }

            Console.WriteLine("-----------------------Methods---------------------");


            //instance
            //encapsulation
            SepetManager sepetManager = new SepetManager();

            sepetManager.Add(product1);
            sepetManager.Add(product2);

            sepetManager.Add2("Armut", "Yeşil Armut", 12, 10);
            sepetManager.Add2("Elma", "Yeşil Elma", 12, 9);
            sepetManager.Add2("Karpuz", "D.Bakır Karpuzu", 12, 8);
        }
Example #5
0
        static void Main(string[] args)
        {
            //string[] meyveler = new string[] { };

            Urun urun1 = new Urun();

            urun1.Adi       = "Elma";
            urun1.Fiyati    = 15;
            urun1.Aciklama  = "Amasya elması";
            urun1.StokAdedi = 50;

            Urun urun2 = new Urun();

            urun2.Adi       = "Karpuz";
            urun2.Fiyati    = 80;
            urun2.Aciklama  = "Diyarbakır karpuzu";
            urun2.StokAdedi = 20;

            Urun[] urunler = new Urun[] { urun1, urun2 }; //verileri urunler dizisine atandı

            foreach (Urun urun in urunler)                // urunler dizisindeki elemanları urun'e atadı Urun tipindeki
            {
                Console.WriteLine(urun.Adi);
                Console.WriteLine(urun.Fiyati);
                Console.WriteLine(urun.Aciklama);
                Console.WriteLine("-----------");
            }

            Console.WriteLine("-----metodlar----");

            SepetManager sepetManager = new SepetManager();

            sepetManager.Ekle(urun1); //sepetManager'deki Ekle komutunu çağırdık
            sepetManager.Ekle(urun2);

            //encapsulation with StokAdedi
            sepetManager.Ekle2("kiraz", "büyük", 10, 50);//sepetManager'daki Ekle2 komutuna gidip ona göre çalışıyor
        }
Example #6
0
        static void Main(string[] args)
        {
            Product urun1 = new Product();

            urun1.Adi      = "Elma";
            urun1.Fiyati   = 15;
            urun1.Aciklama = "Amasya elması";


            Product urun2 = new Product();

            urun2.Adi      = "Karpuz";
            urun2.Fiyati   = 80;
            urun2.Aciklama = "Diyarbakır karpuzu";

            Product[] urunler = new Product[] { urun1, urun2 };

            //type.safe == tip güvenli
            foreach (Product urun in urunler)
            {
                Console.WriteLine(urun.Adi);
                Console.WriteLine(urun.Fiyati);
                Console.WriteLine(urun.Aciklama);
                Console.WriteLine("-------------------------");
            }

            Console.WriteLine("------------Methods---------");
            //Instance
            //encapsulation
            SepetManager sepetManager = new SepetManager();

            sepetManager.Ekle(urun1);
            sepetManager.Ekle(urun2);

            sepetManager.Ekle2("armut", "Yeşil armut", 12, 9);
            sepetManager.Ekle2("elma", "Yeşil elma", 12, 6);
            sepetManager.Ekle2("karpuz", "Diyarbakır karpuz", 12, 7);
        }
Example #7
0
        static void Main(string[] args)
        {
            // CLASS

            Urun urun1 = new Urun();

            urun1.Adi      = "Elma";
            urun1.Fiyati   = 15;
            urun1.Aciklama = " Amasya Elması";

            Urun urun2 = new Urun();

            urun2.Adi      = "Karpuz";
            urun2.Fiyati   = 80;
            urun2.Aciklama = " Diyarbakır Karpuzu";

            Urun[] urunler = new Urun[] { urun1, urun2 };

            foreach (Urun urun in urunler)
            {
                Console.WriteLine(urun.Adi);
                Console.WriteLine(urun.Fiyati);
                Console.WriteLine(urun.Aciklama);
            }

            Console.WriteLine("--- METHODLAR ---");

            // METHODS

            SepetManager sepetManager = new SepetManager();

            sepetManager.Ekle(urun1);
            sepetManager.Ekle(urun2);

            sepetManager.Ekle2("Armut", "Yeşil", 12, 10);
            sepetManager.Ekle2("Elma", "Yeşil", 12, 9);
            sepetManager.Ekle2("Karpuz", "Yeşil", 12, 8);
        }
Example #8
0
        static void Main(string[] args)
        {
            Urun urun1 = new Urun();

            urun1.Adi      = "Elma";
            urun1.Fiyati   = 15;
            urun1.Aciklama = "Amasya elması";

            Urun urun2 = new Urun();

            urun2.Adi      = "Karpuz";
            urun2.Fiyati   = 80;
            urun2.Aciklama = "Diyarbakır karpuzu";

            Urun[] urunler = new Urun[] { urun1, urun2 };

            //type-safe -- tip güvenliği

            foreach (var urun in urunler)
            {
                Console.WriteLine(urun.Adi);
                Console.WriteLine(urun.Fiyati);
                Console.WriteLine(urun.Aciklama);
                Console.WriteLine("------------------");
            }

            Console.WriteLine("-----------------Metotlar------------------");

            //instance - örnek
            SepetManager sepetManager = new SepetManager();

            sepetManager.Ekle(urun1);
            sepetManager.Ekle(urun2);

            sepetManager.Ekle2("Armut", "Yeşil armut", 12.50, 10);
            sepetManager.Ekle2("Elma", "Yeşi elma", 12.50, 9);
            sepetManager.Ekle2("Karpuz", "Diyarbakır karpuzu", 12.50, 8);
        }
Example #9
0
        static void Main(string[] args)
        {
            Product urun1 = new Product();

            urun1.Adi      = "Elma";
            urun1.Fiyat    = 15;
            urun1.Aciklama = "Amasya elması";

            Product urun2 = new Product();

            urun2.Adi      = "Karpuz";
            urun2.Fiyat    = 80;
            urun2.Aciklama = "Diyarbakır Karpuzu";

            Product[] urunler = new Product[] { urun1, urun2 };

            // Product'ın büyük harfle yazılmasının sebebi veri tipi olması type safe - tip güvenliği
            foreach (Product urun in urunler)
            {
                Console.WriteLine(urun.Adi);
                Console.WriteLine(urun.Fiyat);
                Console.WriteLine(urun.Aciklama);
                Console.WriteLine("-------------------");
            }
            Console.WriteLine("----------Metotlar----------");

            //instance - örnek
            //encapsulation

            SepetManager sepetManager = new SepetManager();

            sepetManager.Ekle(urun1);
            sepetManager.Ekle(urun2);

            sepetManager.Ekle2("Armut", "Yeşil Armut", 12, 10);
            sepetManager.Ekle2("Elma", "Yeşil Elma", 8, 9);
            sepetManager.Ekle2("Karpuz", "Diyarbakır Karpuzu", 10, 8);
        }
Example #10
0
        static void Main(string[] args)
        {
            string[] meyveler = new string[] { };

            Urun urun1 = new Urun();

            urun1.Adi      = "Elma";
            urun1.Fiyati   = 15;
            urun1.Aciklama = "Amasya Elması";

            Urun urun2 = new Urun();

            urun2.Adi      = "Karpuz";
            urun2.Fiyati   = 80;
            urun2.Aciklama = "Diyarbakır Karpuzu";

            Urun[] urunler = new Urun[] { urun1, urun2 };

            foreach (Urun urun in urunler)
            {
                Console.WriteLine(urun.Adi);
                Console.WriteLine(urun.Fiyati);
                Console.WriteLine(urun.Aciklama);
                Console.WriteLine("---------------------");
            }

            Console.WriteLine("---------------Metotlar-------------");

            //instance - örnek
            SepetManager sepetmanager = new SepetManager();

            sepetmanager.Ekle(urun1);   //metot böyle çağırılır.
            sepetmanager.Ekle(urun2);

            sepetmanager.Ekle2("Armut", "Yeşil armut", 12, 10);
            sepetmanager.Ekle2("Elma", "Yeşil elma", 12, 9);
            sepetmanager.Ekle2("Karpuz", "Diyarbakır karpuzu", 12, 8);
        }
Example #11
0
        static void Main(string[] args)
        {
            Product prod1 = new Product();

            prod1.Name        = "Apple";
            prod1.Price       = 15;
            prod1.Description = "Big Apple";

            Product prod2 = new Product();

            prod2.Name        = "Watermelon";
            prod2.Price       = 80;
            prod2.Description = "Red Watermelon";

            Product[] products = new Product[] { prod1, prod2 };

            foreach (Product prod in products)
            {
                Console.WriteLine(prod.Name);
                Console.WriteLine(prod.Price);
                Console.WriteLine(prod.Description);
                Console.WriteLine("----------------");
            }

            Console.WriteLine("----------Methods-----------");
            SepetManager sepetManager = new SepetManager();

            sepetManager.Add(prod1);
            sepetManager.Add(prod2);

            //Useless Example.

            /*
             * sepetManager.Add2("Birne", "Yellow Birne", 12);
             * sepetManager.Add2("Apple", "Green Apple, 12);
             * sepetManager.Add2("Melon", "Red Melon", 12);
             */
        }
Example #12
0
        static void Main(string[] args)
        {
            //string urunAdi = "Elma";
            //double fiyat = 10;   DUZENSIZ BIR GOSTERIM DIZI KULLANMAK DAHA MANTIKLI
            //string aciklama = "Amasya Elmasi";

            string[] meyveler = new string[] { "Elma", "Muz" };
            Product  product1 = new Product();

            product1.Adi      = "Elma";
            product1.Fiyati   = 15;
            product1.Aciklama = "Amasya Elmasi";

            Product product2 = new Product();

            product2.Adi      = "Muz";
            product2.Fiyati   = 30;
            product2.Aciklama = "Yerli muz";

            Product[] products = new Product[] { product1, product2 };
            foreach (Product product in products)
            {
                Console.WriteLine(product.Adi);
                Console.WriteLine(product.Fiyati);
                Console.WriteLine(product.Aciklama);
                Console.WriteLine("---------------------------");
            }
            Console.WriteLine("------------METHODS--------------");

            SepetManager sepetManager = new SepetManager();

            sepetManager.Add(product1);
            sepetManager.Add(product2);

            sepetManager.Add2("Armut", "Yesil armut", 12, 10);
            sepetManager.Add2("Elma", "Yesil elma", 10, 9);
            sepetManager.Add2("Karpuz", "Cekirdeksiz Karpuz", 80, 8);
        }
Example #13
0
        static void Main(string[] args)
        {
            Urun urun1 = new Urun();

            urun1.Adi      = "Elma";
            urun1.Fiyati   = 15;
            urun1.Acıklama = "Amasya Elması";

            Urun urun2 = new Urun
            {
                Adi = "Karpuz", Fiyati = 80, Acıklama = "Diyarbakır Karpuzu"
            };

            Urun[] urunler = new Urun[]
            {
                urun1, urun2
            };

            foreach (Urun urun in urunler)
            {
                Console.WriteLine(urun.Adi);
                Console.WriteLine(urun.Fiyati);
                Console.WriteLine(urun.Acıklama);
                Console.WriteLine(new string('*', 50));
            }
            Console.WriteLine("Metotlar");
            Console.WriteLine(new string('-', 50));

            SepetManager sepetManager = new SepetManager();

            sepetManager.Ekle(urun1);
            sepetManager.Ekle(urun2);
            sepetManager.Ekle2("Armut", "Yeşil Armut", 12, 500);



            Console.ReadLine();
        }
Example #14
0
        static void Main(string[] args)
        {
            Products product1 = new Products();

            product1.Name        = "elma";
            product1.Price       = 15;
            product1.Description = "Amasya Elması";
            product1.Stock       = 1200;

            Products product2 = new Products();

            product2.Name        = "Karpuz";
            product2.Price       = 80;
            product2.Description = "Diyarbakır Karpuzu";
            product2.Stock       = 100

                                   Products[] products = new Products[]
            { product1, product2 };

            //type-safe -- tip güvenli
            foreach (Products product in products)
            {
                Console.WriteLine(product.Name);
                Console.WriteLine(product.Price);
                Console.WriteLine(product.Description);
            }

            Console.WriteLine("---------Methods---------");

            //instance -- örnek

            SepetManager sepetManager = new SepetManager();

            sepetManager.Add(product1);
            sepetManager.Add(product2);

            sepetManager.Add2("Armut", "Yeşil Armut", 12);
        }
Example #15
0
        static void Main(string[] args)
        {
            string urunAdi  = " Elma";
            double fiyati   = 15;
            string aciklama = " Amasya elmasi";



            Product urun1 = new Product();

            urun1.Adi      = " Elma ";
            urun1.Fiyati   = 15;
            urun1.Aciklama = " Amasya elmasi";

            Product urun2 = new Product();

            urun2.Adi      = " Karpuz";
            urun2.Fiyati   = 80;
            urun2.Aciklama = " Diyarbakir karpuzu";

            Product[] urunler = new Product[] { urun1, urun2 };
            // type safe -- tip guvenligi onemli/ Verilerin bas harfi buyuk harf

            foreach (Product urun in urunler)
            {
                Console.WriteLine(urun.Adi);
                Console.WriteLine(urun.Fiyati);
                Console.WriteLine(urun.Aciklama);
                Console.WriteLine("-----------------");
            }

            Console.WriteLine("------------Metodlar----------");

            SepetManager sepet = new SepetManager();

            sepet.Ekle(urun1);
            sepet.Ekle(urun2);
        }
Example #16
0
        static void Main(string[] args)
        {
            Product product1 = new Product();

            product1.Id    = 1;
            product1.Name  = "Telefon";
            product1.Price = 5000;

            Product product2 = new Product();

            product2.Id    = 2;
            product2.Name  = "Bilgisayar";
            product2.Price = 10000;

            Product[] product = new Product[] { product1, product2 };

            foreach (var products in product)
            {
                Console.WriteLine(products.Id);
                Console.WriteLine(products.Name);
                Console.WriteLine(products.Price);
                Console.WriteLine("----------------");
            }

            Console.WriteLine("----------------Methods----------------");
            //Instance - Örnek
            //Encapsulation - Bir şeyi düzenli bir şekilde yazma/kapsülleme olayı

            SepetManager sepetManager = new SepetManager();

            sepetManager.Add(product1);
            sepetManager.Add(product2);

            sepetManager.Add2("Bisiklet", "Mavi bisiklet", 500);
            sepetManager.Add2("Tost Makinası", "tost makinası", 300);

            Console.ReadLine();
        }
Example #17
0
        static void Main(string[] args)
        {
            SepetManager sepetManager = new SepetManager();

            Product urun1 = new Product();

            urun1.Adi      = "Elma";
            urun1.Fiyat    = 15;
            urun1.Aciklama = "Taze Amasya Elması";

            Product urun2 = new Product();

            urun2.Adi      = "Karpuz";
            urun2.Fiyat    = 80;
            urun2.Aciklama = "Tarladan Diyarbakır Karpuzu";

            Product[] products = new Product[] { urun1, urun2 };

            foreach (Product urun in products)
            {
                Console.WriteLine(urun.Adi);
                Console.WriteLine(urun.Fiyat);
                Console.WriteLine(urun.Aciklama);
                //Encapsulation
                sepetManager.Ekle(urun);
                Console.WriteLine("--------------------");
            }

            Console.WriteLine("-------Methods-------");



            //sepetManager.Ekle();



            Console.ReadLine();
        }
Example #18
0
        static void Main(string[] args)
        {
            Urun urun1 = new Urun();

            urun1.Adi = "Üzüm";

            Urun urun2 = new Urun();

            urun2.Adi = "Elma";

            Urun[] urunler = new Urun[] { urun1, urun2 };

            foreach (Urun urun in urunler)
            {
                Console.WriteLine(urun.Adi);
            }

            SepetManager sepetManager = new SepetManager();

            sepetManager.Ekle(urun1);
            sepetManager.Ekle(urun2);
            sepetManager.Sil(urun1);
        }
Example #19
0
        static void Main(string[] args)
        {
            Products product1 = new Products();

            product1.Adi      = "elma";
            product1.Aciklama = "yesil elma";
            product1.Fiyati   = 5;

            Products product2 = new Products();

            product2.Adi      = "armut";
            product2.Aciklama = "yesil armut";
            product2.Fiyati   = 7;

            Products product3 = new Products();

            product3.Adi      = "karpuz";
            product3.Aciklama = "diyarbakir karpuz";
            product3.Fiyati   = 22;

            Products[] products = new Products[] { product1, product2, product3 };

            foreach (Products product in products)
            {
                Console.WriteLine(product.Adi);
                Console.WriteLine(product.Aciklama);
                Console.WriteLine(product.Fiyati);
                Console.WriteLine("------------");
            }
            Console.WriteLine("------Methods-----");
            SepetManager sepetManager = new SepetManager();

            sepetManager.Ekle(product1);
            sepetManager.Ekle(product2);
            sepetManager.Ekle(product3);
            sepetManager.Ekle2("fındık", "çakıl fındık", 25, 30000);
        }
Example #20
0
        static void Main(string[] args)
        {
            Product product1 = new Product();

            product1.Id    = 1;
            product1.Name  = "Elma";
            product1.Price = 1.50;
            product1.Stock = 50;

            Product product2 = new Product();

            product2.Id    = 2;
            product2.Name  = "Çilek";
            product2.Price = 8.25;
            product2.Stock = 25;

            Product product3 = new Product();

            product3.Id    = 3;
            product3.Name  = "Muz";
            product3.Price = 10;
            product3.Stock = 15;

            Product[] products = new Product[] { product1, product2, product3, };

            foreach (var alias in products)
            {
                Console.WriteLine("\nProduct Id = {0}\nProduct Name = {1}\nProduct Price = {2}\nProduct Stock = {3}", alias.Id, alias.Name, alias.Price, alias.Stock);
            }



            SepetManager sepetmanager = new SepetManager();

            sepetmanager.Add(product1);
            sepetmanager.Add(product2);
        }
Example #21
0
        static void Main(string[] args)
        {
            Urun urun1 = new Urun();

            urun1.Id        = 1;
            urun1.Adi       = "Elma";
            urun1.Fiyati    = 15;
            urun1.Aciklama  = "Amasya Elması";
            urun1.StokAdedi = 10;

            Urun urun2 = new Urun();

            urun2.Id        = 2;
            urun2.Adi       = "Çilek";
            urun2.Fiyati    = 10;
            urun2.Aciklama  = "Kırmızı çilek";
            urun2.StokAdedi = 15;

            Urun[] urunler = new Urun[] { urun1, urun2 };

            foreach (Urun urun in urunler)
            {
                Console.WriteLine("Ürün Adı: " + urun.Adi);
                Console.WriteLine("Fiyatı: " + urun.Fiyati);
                Console.WriteLine("Açıklaması: " + urun.Aciklama);
                Console.WriteLine("--------------------");
            }

            Console.WriteLine("----------Methodlar----------");

            SepetManager sepetManager = new SepetManager();

            sepetManager.Ekle(urun1);
            sepetManager.Ekle(urun2);

            sepetManager.Ekle2("Karpuz", 70, "Diyarbakır karpuzu", 20);
        }
Example #22
0
        static void Main(string[] args)
        {
            Urun urun1 = new Urun();

            urun1.Adi      = "Elma";
            urun1.Fiyati   = 15;
            urun1.Aciklama = "Amasya Elması";

            Urun urun2 = new Urun();

            urun2.Adi      = "Karpuz";
            urun2.Fiyati   = 40;
            urun2.Aciklama = "Diyarbakır Karpuzu";

            Urun[] urunler = new Urun[] { urun1, urun2 };

            foreach (Urun urun in urunler)
            {
                Console.WriteLine(urun.Adi);
                Console.WriteLine(urun.Fiyati);
                Console.WriteLine(urun.Aciklama);
                Console.WriteLine("-----------------");
            }

            Console.WriteLine("---------Metotlar---------");

            //instance
            //encapsulation
            SepetManager sepetManager = new SepetManager();

            sepetManager.Ekle(urun1);
            sepetManager.Ekle(urun2);

            sepetManager.Ekle2("Armut", "Yeşil Armut", 12, 4);
            sepetManager.Ekle2("Elma", "Yeşil Elma", 18, 7);
            sepetManager.Ekle2("Karpuz", "Diyarbakır Karpuz", 11, 8);
        }
Example #23
0
        static void Main(string[] args)
        {
            Urun urun1 = new Urun();

            urun1.Adi      = "elma";
            urun1.Fiyati   = 15;
            urun1.Aciklama = "Amasya elması";

            Urun urun2 = new Urun();

            urun2.Adi      = "karpuz";
            urun2.Fiyati   = 80;
            urun2.Aciklama = "Diyarbakır karpuzu";

            Urun[] urunler = new Urun[] { urun1, urun2 };

            //type safe-tip güvenli
            foreach (Urun urun in urunler)
            {
                Console.WriteLine(urun.Adi);
                Console.WriteLine(urun.Fiyati);
                Console.WriteLine(urun.Aciklama);
                Console.WriteLine("..................");
            }

            Console.WriteLine("...........Metotlar............");
            //instance-örnek
            //encapsulation-kapsüleme,ayrı ayrı yazılacak şeyleri bir kapsülün içine koyup düzene koymak

            SepetManager sepetManager = new SepetManager();

            sepetManager.Ekle(urun1);
            sepetManager.Ekle(urun2);
            sepetManager.Ekle2("Armut", "Yeşil Armut", 12, 10);
            sepetManager.Ekle2("Elma", "Yeşil Elma", 12, 9);
            sepetManager.Ekle2("Karpuz", "Kırmızı Karpuz", 12, 8);
        }
Example #24
0
        static void Main(string[] args)
        {
            Urun urun1 = new Urun();

            urun1.Adı      = "Elma";
            urun1.Fiyati   = 15;
            urun1.Aciklama = "Amasya elması";

            Urun urun2 = new Urun();

            urun2.Adı      = "Karpuz";
            urun2.Fiyati   = 80;
            urun2.Aciklama = "Diyarbakır karpuzu";

            Urun[] urunler = new Urun[] { urun1, urun2 };

            foreach (Urun urun in urunler)
            {
                Console.WriteLine(urun.Adı);
                Console.WriteLine(urun.Fiyati);
                Console.WriteLine(urun.Aciklama);
                Console.WriteLine("---------------");
            }

            Console.WriteLine("------Metotlar---------");

            SepetManager sepetManager = new SepetManager();

            sepetManager.Ekle(urun1);
            sepetManager.Ekle(urun2);


            //aşağıdakiler gibi yapma,class oluştur
            sepetManager.Ekle2("Armut", "Yeşil armut", 12, 10);
            sepetManager.Ekle2("Elma", "Yeşil elma", 5, 9);
            sepetManager.Ekle2("Karpuz", "Diyarbakır karpuzu", 30, 8);
        }
Example #25
0
        static void Main(string[] args)
        {
            Product product1 = new Product();

            product1.Name   = "Elma";
            product1.Price  = 15;
            product1.Detail = "Amasya Elması";

            Product product2 = new Product();

            product2.Name   = "Karpuz";
            product2.Price  = 80;
            product2.Detail = "Diyarbakır karpuzu";

            Product[] products = new Product[] { product1, product2 };
            foreach (Product product in products)
            {
                Console.WriteLine(product.Name);
                Console.WriteLine(product.Price);
                Console.WriteLine(product.Detail);
                Console.WriteLine("-----------");
            }

            Console.WriteLine("------------Metodlar-------------");

            //instance -örnek oluşturma
            //encapsulation

            SepetManager sepetManager = new SepetManager();

            sepetManager.Add(product1);
            sepetManager.Add(product2);

            sepetManager.Add2("Armut", "Yeşil Armut", 12, 10);
            sepetManager.Add2("Elma", "Yeşil Elma", 12, 9);
            sepetManager.Add2("Karpuz", "Diyarbakır Karpuzu", 12, 8);
        }
Example #26
0
        static void Main(string[] args)
        {
            Product product1 = new Product();

            product1.Name        = "Elma";
            product1.Price       = 15;
            product1.Description = "Amasya Elması";

            Product product2 = new Product();

            product2.Name        = "Karpuz";
            product2.Price       = 80;
            product2.Description = "Diyarbakır karpuzu";

            Product[] products = new Product[] { product1, product2 };

            //type-safe -- tip güvenli
            foreach (Product product in products)
            {
                Console.WriteLine(product.Name);
                Console.WriteLine(product.Price);
                Console.WriteLine(product.Description);
                Console.WriteLine("-----------------");
            }
            Console.WriteLine("------------Methods--------------");

            //instance - örneklemedir
            SepetManager sepetManager = new SepetManager();

            sepetManager.Ekle(product1);
            sepetManager.Ekle(product2);

            sepetManager.Ekle2("Armut", "Yeşil Armut", 12, 10);
            sepetManager.Ekle2("Elma", "Yeşil Elma", 12, 9);
            sepetManager.Ekle2("Karpuz", "Diyarbakır karpuzu", 12, 31);
        }
Example #27
0
        static void Main(string[] args)
        {
            Product product1 = new Product();  //class örneği

            product1.Name        = "Elma";
            product1.Price       = 15;
            product1.Explanation = "Amasya Elması";


            Product product2 = new Product();

            product2.Name        = "Karpuz";
            product2.Price       = 40;
            product2.Explanation = "Diyarbakır karpuzu";

            Product[] products = new Product[] { product1, product2 };

            foreach (Product product in products)
            {
                Console.WriteLine(product.Name);
                Console.WriteLine(product.Price);
                Console.WriteLine(product.Explanation);
                Console.WriteLine("-----------------------");
            }


            Console.WriteLine("-------------Metotlar-----------");

            //instance - örnek class örneği
            //encapsulation

            SepetManager sepetManager = new SepetManager();

            sepetManager.Add(product1);
            sepetManager.Add(product2);
        }
Example #28
0
        static void Main(string[] args)
        {
            Product product1 = new Product();

            product1.Name    = "Elma";
            product1.Price   = 15;
            product1.Comment = "Amasya Elması";

            Product product2 = new Product();

            product2.Name    = "Karpuz";
            product2.Price   = 80;
            product2.Comment = "Diyarbakır karpuzu";

            Product[] products = new Product[] { product1, product2 };

            foreach (var product in products)
            {
                Console.WriteLine(product.Name);
                Console.WriteLine(product.Comment);
                Console.WriteLine(product.Price);
                Console.WriteLine("--------------");
            }
            Console.WriteLine("---------Methods---------");
            //instance - örnek
            //encapsulation

            SepetManager sepetManager = new SepetManager();

            sepetManager.Add(product1);
            sepetManager.Add(product2);

            sepetManager.Ekle2("Armut", "yeşil armut", 12, 10);
            sepetManager.Ekle2("Elma", "yeşil elma", 12, 9);
            sepetManager.Ekle2("Karpuz", "Diyarbakır karpuzu", 12, 8);
        }
Example #29
0
        static void Main(string[] args)
        {
            Product urun1 = new Product();

            urun1.Adi      = "Elma";
            urun1.Fiyati   = 15.99;
            urun1.Aciklama = "Amasya Elması";

            Product urun2 = new Product();

            urun2.Adi      = "Karpuz";
            urun2.Fiyati   = 80;
            urun2.Aciklama = "Diyarbakır Karpuzu";

            Product[] urunler = new Product[] { urun1, urun2 };

            foreach (Product urun in urunler)
            {
                Console.WriteLine(urun.Adi);
                Console.WriteLine(urun.Fiyati);
                Console.WriteLine(urun.Aciklama);
                Console.WriteLine("-----------------------");
            }


            Console.WriteLine("----------------------M-----------------------");



            SepetManager sepetManager = new SepetManager();

            sepetManager.Ekle(urun1);
            sepetManager.Ekle(urun2);
            Console.WriteLine("----------------------------------------------");
            sepetManager.Ekle2("Armut", "Yeşil", 12);
        }
Example #30
0
        static void Main(string[] args)
        {
            Product product1 = new Product();

            product1.Name        = "Elma";
            product1.Cost        = 3.95;
            product1.Explanation = "Amasya Elması";

            Product product2 = new Product();

            product2.Name        = "Karpuz";
            product2.Cost        = 16.9;
            product2.Explanation = "Diyarbakır Karpuzu";

            Product[] products = new Product[] { product1, product2 };

            foreach (Product product in products)
            {
                Console.WriteLine(product.Name);
                Console.WriteLine(product.Cost);
                Console.WriteLine(product.Explanation);
                Console.WriteLine("---------------------");
            }

            Console.WriteLine("----------------Methods-------------");
            //encapsulation

            SepetManager sepetManager = new SepetManager();

            sepetManager.Add(product1);
            sepetManager.Add(product2);

            sepetManager.Add2("Armut", "Ankara", 5.49, 26);
            sepetManager.Add2("Erik", "Can", 8.75, 4);
            sepetManager.Add2("Muz", "İthal", 12.5, 16);
        }