Example #1
0
        static void Main(string[] args)
        {
            PricingRules pricingRules = new PricingRules();

            Console.WriteLine("============>Stating execution <============");
            Console.WriteLine("Pricing table");
            Console.WriteLine("Item | Unit Price | Special Price");
            foreach (var item in pricingRules.pricingList)
            {
                Console.WriteLine(item.Key + "    |" + item.Value.price + "          |" + item.Value.specialPriceCont + " for " + item.Value.specialPrice);
            }
            CheckOut checkOut = new CheckOut(pricingRules);

            Console.WriteLine();
            Console.WriteLine("Scaning products");

            Console.WriteLine("A");
            checkOut.Scan("A");

            Console.WriteLine("B");
            checkOut.Scan("B");

            Console.WriteLine("A");
            checkOut.Scan("A");

            Console.WriteLine("A");
            checkOut.Scan("A");

            Console.WriteLine("Total price : " + checkOut.Total());
            Console.ReadLine();
        }
Example #2
0
 public CheckOut(PricingRules pricingRules)
 {
     this.items        = new Dictionary <string, int>();
     this.pricingRules = pricingRules;
 }