Advertisement
Guest User

Untitled

a guest
Nov 20th, 2017
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.13 KB | None | 0 0
  1. /*
  2. * To change this license header, choose License Headers in Project Properties.
  3. * To change this template file, choose Tools | Templates
  4. * and open the template in the editor.
  5. */
  6. package Domein;
  7.  
  8. /**
  9. *
  10. * @author Laurent De Craene
  11. */
  12. public class Product
  13. {
  14.  
  15. private String naam;
  16. private double prijsExclBtw;
  17. private int btwPercentage;
  18. private int korting6StuksPercentage;
  19.  
  20.  
  21. public Product(String naam, double prijsExclBtw, int btwPercentage,
  22. int korting6StuksPercentage)
  23. {
  24. this.setNaam(naam);
  25. this.setPrijsExclBtw(prijsExclBtw);
  26. this.setBtwPercentage(btwPercentage);
  27. this.setKorting6StuksPercentage(korting6StuksPercentage);
  28. }
  29.  
  30. public final void setNaam(String naam)
  31. {
  32. if (naam.equals(""))
  33. {
  34. this.naam = "onbekend";
  35. } else
  36. {
  37. this.naam = naam;
  38. }
  39. }
  40.  
  41. public final void setPrijsExclBtw(double prijsExclBtw)
  42. {
  43. this.prijsExclBtw = prijsExclBtw;
  44. }
  45.  
  46. public final void setBtwPercentage(int btwPercentage)
  47. {
  48. if (6 <= btwPercentage && btwPercentage <= 21)
  49. {
  50. this.btwPercentage = btwPercentage;
  51. } else
  52. {
  53. this.btwPercentage = 21;
  54. }
  55. }
  56.  
  57. public final void setKorting6StuksPercentage(int korting6StuksPercentage)
  58. {
  59. if (0 < korting6StuksPercentage && korting6StuksPercentage < 50)
  60. {
  61. this.korting6StuksPercentage = korting6StuksPercentage;
  62. } else
  63. {
  64. this.korting6StuksPercentage = 0;
  65. }
  66. }
  67.  
  68. public String getNaam()
  69. {
  70. return naam;
  71. }
  72.  
  73. public double getPrijsExclBtw()
  74. {
  75. return prijsExclBtw;
  76. }
  77.  
  78. public int getBtwPercentage()
  79. {
  80. return btwPercentage;
  81. }
  82.  
  83. public int getKorting6StuksPercentage()
  84. {
  85. return korting6StuksPercentage;
  86. }
  87.  
  88. public double berekenPrijsMetBtw()
  89. {
  90. double prijsMetBtw;
  91. prijsMetBtw = prijsExclBtw * (btwPercentage / 100);
  92. return prijsMetBtw;
  93. }
  94. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement