Beispiel #1
0
        public SKUProduct getProduct(string Productid)
        {
            SKUProduct product = new SKUProduct();

            switch (Productid)
            {
            case "A":
                product.Id    = Productid;
                product.Price = 50;

                break;

            case "B":
                product.Id    = Productid;
                product.Price = 30;

                break;

            case "C":
                product.Id    = Productid;
                product.Price = 20;

                break;

            case "D":
                product.Id    = Productid;
                product.Price = 15;
                break;
            }
            return(product);
        }
Beispiel #2
0
        static void Main(string[] args)
        {
            SKUProduct        sKUProduct      = new SKUProduct();
            PriceCalculator   priceCalculator = new PriceCalculator();
            List <SKUProduct> listofProducts  = new List <SKUProduct>();

            Console.WriteLine("Enter total number of order");
            int numberOfUnits = Convert.ToInt32(Console.ReadLine());

            for (int i = 0; i < numberOfUnits; i++)
            {
                Console.WriteLine("Please enter type of sku product A,B,C,D");
                string     skuType = Console.ReadLine();
                SKUProduct product = sKUProduct.getProduct(skuType.ToUpper());
                listofProducts.Add(product);
            }

            int totalCost = priceCalculator.GetTotalPrice(listofProducts);

            Console.WriteLine("Total Cost For {0} Product's is {1}", numberOfUnits, totalCost);
            Console.ReadLine();
        }