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; }
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); }