/// <summary>
        /// Main
        /// </summary>
        /// <param name="args"></param>
        static void Main(string[] args)
        {
            var terminal = new PointOfSaleTerminal();

            terminal.ScanProduct("C");
            terminal.ScanProduct("C");
            terminal.ScanProduct("C");
            terminal.ScanProduct("C");
            terminal.ScanProduct("C");
            terminal.ScanProduct("C");
            decimal result = terminal.CalculateTotal();

            Console.WriteLine(result);
        }
示例#2
0
        /// <summary>
        /// This method is used to run all the methods in the library (i.e. for unit tests to call)
        /// </summary>
        /// <param name="input">The string input containing what needs to be scanned in</param>
        /// <returns>Returns the result of calling the CalculateTotal() method</returns>
        public decimal ScanItems(String input)
        {
            String[] inputs = input.Split(',');

            PointOfSaleTerminal terminal = new PointOfSaleTerminal();

            terminal.SetPricing(1.25M, 4.25M, 1.00M, 0.75M);
            foreach (string v in inputs)
            {
                terminal.ScanProduct(v);
            }
            decimal result = terminal.CalculateTotal();

            Console.WriteLine(input + " totals to: $" + result);             //Used for testing purposes, not needed for final product.

            return(result);
        }