LoganBlackisle

DagligSkaev

Sep 10th, 2019
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.00 KB | None | 0 0
  1. package ordination;
  2.  
  3. import java.time.LocalDate;
  4. import java.time.LocalTime;
  5. import java.util.ArrayList;
  6. import java.util.List;
  7.  
  8. public class DagligSkaev extends Ordination {
  9. private List<Dosis> doser = new ArrayList<>();
  10.  
  11. public DagligSkaev(LocalDate startDen, LocalDate slutDen, Laegemiddel laegemiddel) {
  12. super(startDen, slutDen, laegemiddel);
  13. }
  14.  
  15. public void opretDosis(LocalTime tid, double antal) {
  16. Dosis dosis = new Dosis(tid, antal);
  17. doser.add(dosis);
  18. }
  19.  
  20. @Override
  21. public double samletDosis() {
  22. double antal = 0;
  23. for (Dosis d : doser) {
  24. antal += d.getAntal();
  25. }
  26. antal = antal * super.antalDage();
  27. return antal;
  28. }
  29.  
  30. public List<Dosis> getDoser() {
  31. return doser;
  32. }
  33.  
  34. @Override
  35. public double doegnDosis() {
  36. double antal = 0;
  37. for (Dosis d : doser) {
  38. antal += d.getAntal();
  39. }
  40. return antal;
  41. }
  42.  
  43. public Laegemiddel getLaegemiddel() {
  44. return laegemiddel;
  45. }
  46.  
  47. @Override
  48. public String getType() {
  49. return "DagligSkaev";
  50. }
  51. }
Add Comment
Please, Sign In to add comment