Module Core, clss Sale : ajout méthd getTotalPrice

This commit is contained in:
Notmoo 2017-07-30 21:14:30 +02:00
parent 064b35aaea
commit 5a84ed76a1

View File

@ -100,4 +100,12 @@ public class Sale implements ILoggable, Serializable{
public void setStatus(SaleStatus status) { public void setStatus(SaleStatus status) {
this.status = 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;
}
} }