Exemple #1
0
        static void Main(string[] args)
        {
            Liquor vodka = new Liquor(95);

            Console.WriteLine(vodka);

            IVisitor endOfYearVisitor = new EndOfYearTax();

            Console.WriteLine($"Price after tax = {vodka.Accept(endOfYearVisitor)}");

            SomeProduct someProduct = new SomeProduct(213);

            Console.WriteLine(someProduct);

            Console.WriteLine($"Price after tax = {someProduct.Accept(endOfYearVisitor)}");

            Console.WriteLine($"Price after gift = {someProduct.Accept(new GiftVisitor())}");

            Console.WriteLine($"Price after gift = {vodka.Accept(new GiftVisitor())}");

            Console.WriteLine("*******************************************");

            Shop shop = new Shop(1000);

            Console.WriteLine(shop);

            Console.WriteLine($"Price after gift = {shop.Accept(new GiftVisitor())}");

            Console.WriteLine($"Price after tax = {shop.Accept(endOfYearVisitor)}");
        }
Exemple #2
0
        static void Main(string[] args)
        {
            Liquor vodka = new Liquor(95);

            Console.WriteLine(vodka);
            IVisitor vodkaEndOfYearVisitor = new EndOfYearTax();

            Console.WriteLine($"Price after tax = {vodka.Accept(vodkaEndOfYearVisitor)}");

            Perfume boss = new Perfume(100);

            Console.WriteLine(boss);
            IVisitor bossEndOfYearVisitor = new EndOfYearTax();

            Console.WriteLine($"Price after tax = {boss.Accept(bossEndOfYearVisitor)}");

            IVisitor bossOneShekelPrice = new OneShekelPrice();

            Console.WriteLine($"Price after One Shekel Sale = {boss.Accept(bossOneShekelPrice)}");

            ShopRent shop = new ShopRent(1000);

            Console.WriteLine(shop);
            IVisitor shopEndOfYearVisitor = new EndOfYearTax();

            Console.WriteLine($"Price after tax = {shop.Accept(shopEndOfYearVisitor)}");
        }
        static void Main(string[] args)
        {
            Liquor vodka = new Liquor(95);

            Console.WriteLine(vodka);

            IVisitor endOfYearVisitor = new EndOfYearTax();

            Console.WriteLine($"Price after tax = {vodka.Accept(endOfYearVisitor)}");

            // Create new perfume

            Perfume channel = new Perfume(400);

            Console.WriteLine(channel);

            // Create new visitor

            IVisitor oneShekelVisitor = new OneShekelSale();

            Console.WriteLine($"Price after sale = {channel.Accept(oneShekelVisitor)}");

            // Create new shop rent

            ShopRent castro = new ShopRent(10000);

            Console.WriteLine(castro);
            Console.WriteLine($"Price after tax = {castro.Accept(endOfYearVisitor)}");
            Console.WriteLine($"Price after sale = {castro.Accept(oneShekelVisitor)}");
        }
Exemple #4
0
        static void Main(string[] args)
        {
            // Liquer

            Liquor vodka = new Liquor(95);

            Console.WriteLine(vodka);

            IVisitor endOfYearVisitor = new EndOfYearTax();

            Console.WriteLine($"Price after tax = {vodka.Accept(endOfYearVisitor)}");

            // Perfume

            Perfume per = new Perfume(500);

            Console.WriteLine(per);

            IVisitor OneIlsVisitor = new OneILSSale();

            Console.WriteLine($"Price after tax = {per.Accept(OneIlsVisitor)}");


            // ShopRent

            ShopRent shop = new ShopRent(5000);

            Console.WriteLine(shop);

            Console.WriteLine($"Price after tax = {shop.Accept(endOfYearVisitor)}");
        }
Exemple #5
0
        static void Main(string[] args)
        {
            Liquor vodka = new Liquor(95);

            Console.WriteLine(vodka);

            IVisitor endOfYearVisitor = new EndOfYearTax();

            Console.WriteLine($"Price after tax = {vodka.Accept(endOfYearVisitor)}");

            IVisitor OneShekelvisitor = new OneShekelSale();

            Console.WriteLine($"Price after one shekel sale = {vodka.Accept(OneShekelvisitor)}");

            ShopRent shop = new ShopRent(100);

            Console.WriteLine($"Price after shop rent = {shop.Accept(OneShekelvisitor)}");
        }
Exemple #6
0
        static void Main(string[] args)
        {
            Liquor   vodka    = new Liquor(95);
            Perfume  calvin   = new Perfume(300);
            ShopRent shopRent = new ShopRent(4500);

            IVisitor endOfYearVisitor = new EndOfYearTax();
            IVisitor oneShekelSale    = new OneShekelSale();

            Console.WriteLine(vodka);
            Console.WriteLine($"vodka after tax = {vodka.Accept(endOfYearVisitor)}");
            Console.WriteLine($"vodka after sale = {vodka.Accept(oneShekelSale)}");
            Console.WriteLine(calvin);
            Console.WriteLine($"calvin after tax = {calvin.Accept(endOfYearVisitor)}");
            Console.WriteLine($"calvin after sale = {calvin.Accept(oneShekelSale)}");
            Console.WriteLine(shopRent);
            Console.WriteLine($"shopRent after tax = {shopRent.Accept(endOfYearVisitor)}");
            Console.WriteLine($"shopRent after sale = {shopRent.Accept(oneShekelSale)}");
        }
Exemple #7
0
        static void Main(string[] args)
        {
            Liquor vodka = new Liquor(95);

            Console.WriteLine(vodka);

            IVisitor endOfYearVisitor = new EndOfYearTax();

            Console.WriteLine($"Price after tax = {vodka.Accept(endOfYearVisitor)}");
        }
        static void Main(string[] args)
        {
            Liquor   vodka = new Liquor(95);
            Perfume  perf  = new Perfume(100);
            ShopRent shop  = new ShopRent(10000);

            Console.WriteLine(vodka);
            Console.WriteLine(perf);
            Console.WriteLine(shop);

            IVisitor endOfYearVisitor     = new EndOfYearTax();
            IVisitor oneShekelSaleVisitor = new OneShekelSaleTax();

            Console.WriteLine($"Price after tax = {vodka.Accept(endOfYearVisitor)}");
            Console.WriteLine($"Price after tax = {perf.Accept(endOfYearVisitor)}");
            Console.WriteLine($"One shekel sale = {vodka.Accept(oneShekelSaleVisitor)}");
            Console.WriteLine($"One shekel sale = {perf.Accept(oneShekelSaleVisitor)}");
            Console.WriteLine($"Price after tax = {shop.Accept(endOfYearVisitor)}");
            Console.WriteLine($"One shekel sale = {shop.Accept(oneShekelSaleVisitor)}");
        }
Exemple #9
0
        static void Main(string[] args)
        {
            Liquor vodka = new Liquor(95);

            Console.WriteLine(vodka);

            Perfume perfume = new Perfume(10);

            ShopRent shopRent = new ShopRent(100);

            IVisitor endOfYearVisitor     = new EndOfYearTax();
            IVisitor oneShekelSaleVisitor = new OneShekelSale();

            Console.WriteLine($"Price after liquor tax = {vodka.Accept(endOfYearVisitor)}");
            Console.WriteLine($"Price after prefume tax = {perfume.Accept(endOfYearVisitor)}");
            Console.WriteLine($"Price after rent tax = {shopRent.Accept(endOfYearVisitor)}");

            Console.WriteLine($"Price after liquor sale = {vodka.Accept(oneShekelSaleVisitor)}");
            Console.WriteLine($"Price after prefume sale = {perfume.Accept(oneShekelSaleVisitor)}");
            Console.WriteLine($"Price after rent sale = {shopRent.Accept(oneShekelSaleVisitor)}");
        }
Exemple #10
0
        static void Main(string[] args)
        {
            Liquor vodka = new Liquor(95);

            Console.WriteLine(vodka);

            Perfume perfume = new Perfume(300);

            Console.WriteLine(perfume);

            IVisitor endOfYearTax  = new EndOfYearTax();
            IVisitor oneShekelSale = new OneShekelSale();

            Console.WriteLine($"Vodka price after end of year tax = {vodka.Accept(endOfYearTax)}");
            Console.WriteLine($"Perfume price after one shekel sale = {perfume.Accept(oneShekelSale)}");
        }
Exemple #11
0
        static void Main(string[] args)
        {
            Liquor vodka = new Liquor(95);

            Console.WriteLine(vodka);

            IVisitor endOfYearVisitor = new EndOfYearTax();

            Console.WriteLine($"Price after tax = {vodka.Accept(endOfYearVisitor)}");
            IVisitor oneShakelSale = new OneShekelSale();
            ShopRent shopRent      = new ShopRent(4000);

            Console.WriteLine(shopRent);
            Console.WriteLine($"Price after sale = {shopRent.Accept(oneShakelSale)}");
            Console.ReadLine();
        }