diff --git a/poo/value_objects/code/Products.java b/poo/value_objects/code/Products.java index 2000765..ea26948 100644 --- a/poo/value_objects/code/Products.java +++ b/poo/value_objects/code/Products.java @@ -16,7 +16,8 @@ public void addProduct(Product product) { public Money getProductsCost() { Money money = new Money(0); for (Product product : products) { - money = money.addMoney(product.getCost()); + Money productCost = product.getCost(); + money = money.addMoney(productCost); } return money; }