static void Main(string[] args)
 {
     SalesTaxMonitor vatMonitor = new SalesTaxMonitor();
     Chocolate chocolate = new Chocolate(20);// price 20
     SoftDrink drinks = new SoftDrink(40);// price 40
     Fruit apple = new Fruit(15);// price 15
     Console.WriteLine("The VAT summary");
     Console.WriteLine(chocolate.AddTaxMonitor(vatMonitor).ToString("#.##"));
     Console.WriteLine(drinks.AddTaxMonitor(vatMonitor).ToString("#.##"));
     Console.WriteLine(apple.AddTaxMonitor(vatMonitor).ToString("#.##"));
     Console.ReadLine();
 }
Example #2
0
        static void Main(string[] args)
        {
            TaxVisitor taxVisitor = new TaxVisitor();

            HardFood  biskit   = new HardFood(20.18);
            Tobacco   goldLief = new Tobacco(50.518);
            Chocolate kitkat   = new Chocolate(70.958);

            Console.WriteLine("price+tax: " + biskit.accept(taxVisitor));
            Console.WriteLine("price+tax: " + goldLief.accept(taxVisitor));
            Console.WriteLine("price+tax: " + kitkat.accept(taxVisitor));
        }
Example #3
0
        static void Main(string[] args)
        {
            SalesTaxMonitor vatMonitor = new SalesTaxMonitor();
            Chocolate       chocolate  = new Chocolate(20); // price 20
            SoftDrink       drinks     = new SoftDrink(40); // price 40
            Fruit           apple      = new Fruit(15);     // price 15

            Console.WriteLine("The VAT summary");
            Console.WriteLine(chocolate.AddTaxMonitor(vatMonitor).ToString("#.##"));
            Console.WriteLine(drinks.AddTaxMonitor(vatMonitor).ToString("#.##"));
            Console.WriteLine(apple.AddTaxMonitor(vatMonitor).ToString("#.##"));
            Console.ReadLine();
        }
Example #4
0
 public double AddTax(Chocolate aChocolate)
 {
     Console.WriteLine("State Tax Added with a Chocolate");
     return(aChocolate.Price * 1.005);
 }
Example #5
0
 public double visit(Chocolate chocolate)
 {
     return(chocolate.getPrice() + chocolate.getPrice() * 0.30);
 }
 public double AddTax(Chocolate aChocolate)
 {
     Console.WriteLine("Sales Tax Added with a Chocolate");
     return aChocolate.Price*1.015;
 }
 public double AddTax(Chocolate aChocolate)
 {
     Console.WriteLine("No source Tax for Chocolate");
     return(aChocolate.Price);
 }