From 5a84ed76a1851bc63861c1060ccac32f0018807c Mon Sep 17 00:00:00 2001 From: Notmoo Date: Sun, 30 Jul 2017 21:14:30 +0200 Subject: [PATCH] =?UTF-8?q?Module=20Core,=20clss=20Sale=20:=20ajout=20m?= =?UTF-8?q?=C3=A9thd=20getTotalPrice?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/pqt/core/entities/sale/Sale.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Workspace/core/src/main/java/com/pqt/core/entities/sale/Sale.java b/Workspace/core/src/main/java/com/pqt/core/entities/sale/Sale.java index 1da9bd55..47adb233 100644 --- a/Workspace/core/src/main/java/com/pqt/core/entities/sale/Sale.java +++ b/Workspace/core/src/main/java/com/pqt/core/entities/sale/Sale.java @@ -100,4 +100,12 @@ public class Sale implements ILoggable, Serializable{ public void setStatus(SaleStatus status) { this.status = status; } + + public double getTotalPrice() { + double totalPrice = 0; + for(Product product : this.products.keySet()){ + totalPrice+=product.getPrice()*(double)this.products.get(product); + } + return totalPrice; + } }