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();
        }
 public abstract void CalculateClothTax(Cloth cloth);
Beispiel #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);
 }