Advertisement
Guest User

Untitled

a guest
May 27th, 2016
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.30 KB | None | 0 0
  1. public class AsfaleiaZwhs {
  2.  
  3. private static int ucode;
  4. public static int kk = 0;
  5. private int duration;
  6. private int byear;
  7. private int bmonth;
  8. private int bday;
  9. private int code;
  10. static int kpelaths;
  11. private int amount;
  12.  
  13.  
  14. public AsfaleiaZwhs(int akpelaths) {
  15. kpelaths = akpelaths;
  16. kk = kk+1;
  17.  
  18. }
  19. //Setters
  20.  
  21. public void setDuration(int aduration) {
  22. duration = aduration;
  23. }
  24.  
  25. public void setByear(int abyear) {
  26. byear = abyear;
  27. }
  28.  
  29. public void setBmonth(int abmonth) {
  30. bmonth = abmonth;
  31. }
  32.  
  33. public void setBday(int abday) {
  34. bday = abday;
  35. }
  36.  
  37. public void setAmount(int aamount) {
  38. amount = aamount;
  39. }
  40. public void setUcode(int aucode) {
  41. ucode = aucode;
  42. }
  43. public void setKpelaths(int akpelaths) {
  44. kpelaths = akpelaths;
  45. }
  46.  
  47. //Getters
  48.  
  49. public int getDuration() {
  50. return duration;
  51. }
  52.  
  53. public int getByear() {
  54. return byear;
  55. }
  56.  
  57. public int getBmonth() {
  58. return bmonth;
  59. }
  60.  
  61. public int getBday() {
  62. return bday;
  63. }
  64.  
  65. public int getAmount() {
  66. return amount;
  67. }
  68. public int getUcode() {
  69. return ucode;
  70. }
  71. public int getKpelaths() {
  72. return kpelaths;
  73. }
  74. //ToString//
  75. public String toString() {
  76. return "Diarkeia: " + duration +
  77. "\nHmerominia Enarkshs: " +byear+"/"+bmonth+"/"+bday+
  78. "\nPoso: " + amount +
  79. "\nKwdikos Asfaleias: " + ucode +
  80. "\nKwdikos Pelath: " + kpelaths;
  81. }
  82.  
  83. public static int ypologismos() {
  84.  
  85. return (2016-Demo.arrayobj[kpelaths].getYear())* 6 + 30;
  86.  
  87. }
  88.  
  89. public static void emfaniseis() {
  90. for(int i = 1; i <= (AsfaleiaZwhs.kk); i++) {
  91. System.out.println(Demo.arrayasf[i].toString());
  92.  
  93. }
  94. }
  95.  
  96. public static void emfanishasfaleias(int m) {
  97. for (int i=0; i<=(Demo.arrayasf.length); i++) {
  98. int l = Demo.arrayasf[i].getKpelaths();
  99. if (l == m) {
  100. System.out.println(Demo.arrayasf[i].toString());
  101. }
  102. }
  103. }
  104.  
  105. public boolean elegxosasfaleias(int n) {
  106. int p = 0;
  107. for (int i=0; i<(Demo.arrayasf.length); i++) {
  108. int v = Demo.arrayasf[i].getKpelaths();
  109. if ( n == v) {
  110. p++;
  111. }
  112. }
  113. if (p > 0) {
  114. return true;
  115. } else {
  116. return false;
  117. }
  118. }
  119. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement