Exemple #1
0
 public double getTotal() {
   double total = 0;
   for (LigneCommande lc : items.values()) {
     total += lc.getPrix() * lc.getQuantite();
   }
   return total;
 }
Exemple #2
0
 public void addArticle(Produit p, int quantite) {
   if (items.get(p.getIdProduit()) == null) {
     LigneCommande lc = new LigneCommande();
     lc.setProduit(p);
     lc.setQuantite(quantite);
     lc.setPrix(p.getPrix());
   } else {
     LigneCommande lc = items.get(p.getIdProduit());
     lc.setQuantite(lc.getQuantite() + quantite);
   }
 }