コード例 #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
ファイル: EndOfYearTax.cs プロジェクト: 2515898018/14.07.2019
 public double Visit(Perfume perfume)
 {
     return(perfume.Price * 0.3);
 }
コード例 #3
0
 public double Visit(Perfume perfume)
 {
     return(1);
 }