コード例 #1
0
        /// <summary>
        /// Runs the user input through the methods from the PointOfSaleTerminalLibrary
        /// </summary>
        /// <param name="input">The products to be scanned</param>
        /// <returns>Returns the total cost of the user input</returns>
        public decimal RunCode(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();

            savings = terminal.CalculateSavings();

            return(result);
        }