Пример #1
0
        static void Main(string[] args)
        {
            Liquor   vodka  = new Liquor(95);
            Perfume  calvin = new Perfume(200);
            ShopRent shop   = new ShopRent(1000000000);

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

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

            Console.WriteLine($"VODKA Price after tax = {vodka.Accept(endOfYearVisitor)}");
            Console.WriteLine($"CALVIN Price after tax = {calvin.Accept(endOfYearVisitor)}");
            Console.WriteLine($"SHOP Price after tax = {shop.Accept(endOfYearVisitor)}");
            Console.WriteLine($"VODKA 1 shekel price = {vodka.Accept(oneShekelSale)}");
            Console.WriteLine($"CALVIN 1 shekel price= {calvin.Accept(oneShekelSale)}");
            Console.WriteLine($"SHOP 1 shekel price= {shop.Accept(oneShekelSale)}");
        }
Пример #2
0
 public double Visit(ShopRent shopRent)
 {
     return(shopRent.Price * 2);
 }
Пример #3
0
 public double Visit(ShopRent shopRent)
 {
     return(1);
 }