Raizekas

Untitled

Apr 27th, 2021
34
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package projektas.service;
  2.  
  3. import projektas.duombaze.entities.Preke;
  4.  
  5. import java.util.ArrayList;
  6.  
  7. public class PrekeVeiksmai
  8. {
  9. public static double visuPrekiuKainuSuma(ArrayList<Preke> prekes)
  10. {
  11. double suma = 0;
  12.  
  13. for (int i = 0; i < prekes.size(); i++)
  14. {
  15. suma += prekes.get(i).getKaina();
  16. }
  17. return suma;
  18. }
  19.  
  20.  
  21. public static double visuPrekiuKiekiuKainuSuma(ArrayList<Preke> prekes)
  22. {
  23. double suma = 0;
  24.  
  25. for (int i = 0; i < prekes.size(); i++)
  26. {
  27. suma += prekes.get(i).getKaina() * prekes.get(i).getKiekis();
  28. }
  29. return suma;
  30. }
  31. }
  32.  
RAW Paste Data