예제 #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)}");

            // 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)}");
        }
예제 #2
0
        static void Main(string[] args)
        {
            ShopRent shop = new ShopRent();

            Console.WriteLine(shop);

            IVisitor shekel = new OneShekelSale();

            Console.WriteLine($"Price after tax = {shop.Accept(shekel)}");
        }
예제 #3
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)}");
        }
예제 #4
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();
        }
예제 #5
0
파일: Program.cs 프로젝트: royms/visitor
        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)}");
        }
예제 #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)}");
        }
예제 #7
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)}");
        }