Example #1
0
        static void Main(string[] args)
        {
            TaxCalculator calculator = new TaxCalculator();
            Cloth         playera    = new Cloth {
                Name = "playera", Total = 100
            };
            Cloth jeans = new Cloth {
                Name = "jeans", Total = 300
            };
            Food platano = new Food {
                Name = "platano", Total = 20
            };
            Food carne = new Food {
                Name = "carne", Total = 250
            };

            calculator.Attach(playera);
            calculator.Attach(jeans);
            calculator.Attach(platano);
            calculator.Attach(carne);

            calculator.Accept(new MexicoVisitor());

            Console.ReadLine();
        }
Example #2
0
 public abstract void CalculateClothTax(Cloth cloth);
Example #3
0
 public override void CalculateClothTax(Cloth cloth)
 {
     Console.WriteLine("El impuesto de esta ropa {0} es de {1}", cloth.Name, cloth.Total * 0.16);
 }