Пример #1
0
        public void buy(AbstractProduct product)
        {
            orders.Add(product);

            if (product.NewArrival && product.getProductType() == ProductType.BEVERAGE)
            {
                discount = CondimentDiscount.ENABLED;
            }

            totalPrice += product.getPrice(discount);
        }
Пример #2
0
        public void buy(AbstractProduct product)
        {
            orders.Add(product);

            if (product.NewArrival && product.getProductType() == ProductType.BEVERAGE)
            {
                discount = CondimentDiscount.ENABLED;
            }

            totalPrice += product.getPrice(discount);
        }
        public string print(CondimentDiscount discount)
        {
            if (this.productType == ProductType.CONDIMENT)
            {
                if (discount == CondimentDiscount.ENABLED && this.newArrival)
                {
                    return this.name + "(" + this.price.ToString("#0.00") + "*50%)";
                }
                else if (discount == CondimentDiscount.ENABLED || this.newArrival)
                {
                    return this.name + "(" + this.price.ToString("#0.00") + "*80%)";
                }
            }

            return this.name + "(" + this.price.ToString("#0.00") + ")";
        }
        public double getPrice(CondimentDiscount discount)
        {
            if (this.productType == ProductType.CONDIMENT)
            {
                if ((discount == CondimentDiscount.ENABLED && this.newArrival))
                {
                    return this.price * 0.5;
                }
                else if (discount == CondimentDiscount.ENABLED || this.newArrival)
                {
                    return this.price * 0.8;
                }
            }

            return this.price;
        }
Пример #5
0
        public string print(CondimentDiscount discount)
        {
            if (this.productType == ProductType.CONDIMENT)
            {
                if (discount == CondimentDiscount.ENABLED && this.newArrival)
                {
                    return(this.name + "(" + this.price.ToString("#0.00") + "*50%)");
                }
                else if (discount == CondimentDiscount.ENABLED || this.newArrival)
                {
                    return(this.name + "(" + this.price.ToString("#0.00") + "*80%)");
                }
            }

            return(this.name + "(" + this.price.ToString("#0.00") + ")");
        }
Пример #6
0
        public double getPrice(CondimentDiscount discount)
        {
            if (this.productType == ProductType.CONDIMENT)
            {
                if ((discount == CondimentDiscount.ENABLED && this.newArrival))
                {
                    return(this.price * 0.5);
                }
                else if (discount == CondimentDiscount.ENABLED || this.newArrival)
                {
                    return(this.price * 0.8);
                }
            }

            return(this.price);
        }