Exemplo n.º 1
0
        static void Print(Product item)
        {
            ProductDiscount discount = item as ProductDiscount;

            if (discount != null)
            {
                Console.WriteLine(discount.ProductType + " With Cost: " + discount.Cost + " and discount: " + discount.Discount);
            }
            else
            {
                Console.WriteLine(item.ProductType + " With Cost: " + item.Cost);
            }
        }
Exemplo n.º 2
0
        static bool CheckCost(Product item, double Amount)
        {
            ProductDiscount discount = item as ProductDiscount;

            if (discount == null)
            {
                if (item.Cost < Amount)
                {
                    return(true);
                }
            }
            else if ((discount.Cost - discount.Cost * discount.Discount / 100) < Amount)
            {
                return(true);
            }
            return(false);
        }