public bool Add(Product item) { if (!this.CanAddItem(item)) { return false; } this.bagWeigth += item.Weight; this.bagCost += item.Cost; this.products.Push(item); return true; }
private bool CanAddItem(Product item) { return this.bagWeigth + item.Weight <= this.bagCapacity; }