Advertisement
Guest User

Untitled

a guest
Sep 21st, 2014
211
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.04 KB | None | 0 0
  1. public class MyDate903
  2. {
  3. private int day;
  4. private int month;
  5. private int year;
  6.  
  7. public MyDate903(int day, int month, int year)
  8. {
  9. this.day = day;
  10. this.month = month;
  11. this.year = year;
  12. }
  13.  
  14. public MyDate903()
  15. {
  16. this.day = 3;
  17. this.month = 9;
  18. this.year = 14;
  19. }
  20.  
  21. public int getDay()
  22. {
  23. return day;
  24. }
  25.  
  26. public void setDay(int d)
  27. {
  28. day = d;
  29. }
  30.  
  31. public int getMonth()
  32. {
  33. return month;
  34. }
  35.  
  36. public void setMonth(int m)
  37. {
  38. month = m;
  39. }
  40.  
  41. public int getYear()
  42. {
  43. return year;
  44. }
  45.  
  46. public void setYear(int y)
  47. {
  48. year = y;
  49. }
  50.  
  51. public String displayDate()
  52. {
  53. return day + "/" + month + "/" + year;
  54. }
  55.  
  56. public boolean isLeapYear()
  57. {
  58. if (year % 4 == 0 && year % 100 != 0 || year % 400 == 0)
  59. return true;
  60. else
  61. return false;
  62. }
  63.  
  64. public int daysInMonth()
  65. {
  66. if (month == 1)
  67. {
  68. return 31;
  69.  
  70. }
  71. else if (month == 2 && isLeapYear())
  72. {
  73. return 29;
  74.  
  75. }
  76. else if (month == 2 && !isLeapYear())
  77. {
  78. return 28;
  79. }
  80. else if (month == 3)
  81. {
  82. return 31;
  83. }
  84. else if (month == 4)
  85. {
  86. return 30;
  87. }
  88. else if (month == 5)
  89. {
  90. return 31;
  91. }
  92. else if (month == 6)
  93. {
  94. return 30;
  95. }
  96. else if (month == 7)
  97. {
  98. return 31;
  99. }
  100. else if (month == 8)
  101. {
  102. return 31;
  103. }
  104. else if (month == 9)
  105. {
  106. return 30;
  107. }
  108. else if (month == 10)
  109. {
  110. return 31;
  111. }
  112. else if (month == 11)
  113. {
  114. return 30;
  115. }
  116. else if (month == 12)
  117. {
  118. return 31;
  119. }
  120. else
  121. {
  122. return -1;
  123. }
  124.  
  125. }
  126.  
  127. public String getAstroSign()
  128. {
  129. if (month == 1 && day <= 20)
  130. {
  131. return "Capricorn";
  132. }
  133. else if (month == 2 && day >= 20)
  134. {
  135. return "Aquarius";
  136. }
  137. else if (month == 2 && day <= 19)
  138. {
  139. return "Aquarius";
  140. }
  141. else if (month == 2 && day >= 20)
  142. {
  143. return "Pisces";
  144. }
  145. else if (month == 3 && day <= 20)
  146. {
  147. return "Pisces";
  148. }
  149. else if (month == 3 && day >= 21)
  150. {
  151. return "Aries";
  152. }
  153. else if (month == 4 && day <= 19)
  154. {
  155. return "Aries";
  156. }
  157. else if (month == 4 && day >= 20)
  158. {
  159. return "Taurus";
  160. }
  161. else if (month == 5 && day <= 20)
  162. {
  163. return "Taurus";
  164. }
  165. else if (month == 5 && day >= 21)
  166. {
  167. return "Gemini";
  168. }
  169. else if (month == 6 && day <= 20)
  170. {
  171. return "Gemini";
  172. }
  173. else if (month == 6 && day >= 21)
  174. {
  175. return "Cancer";
  176. }
  177. else if(month ==7 && day <= 22)
  178. {
  179. return "Cancer";
  180. }
  181. else if(month == 7 && day >=23)
  182. {
  183. return "Leo";
  184. }
  185. else if(month == 8 && day <= 22)
  186. {
  187. return "Leo";
  188. }
  189. else if(month == 8 && day >=23)
  190. {
  191. return "Virgo";
  192. }
  193. else if(month == 9 && day <=22)
  194. {
  195. return "Virgo";
  196. }
  197. else if(month == 9 && day >= 23)
  198. {
  199. return "Libra";
  200. }
  201. else if(month == 10 && day <= 22)
  202. {
  203. return "Libra";
  204. }
  205. else if(month == 10 && day >= 23)
  206. {
  207. return "Scorpio";
  208. }
  209. else if(month == 11 && day <=21)
  210. {
  211. return "Scorpio";
  212. }
  213. else if(month == 11 && day >= 22)
  214. {
  215. return "Sagittarius";
  216. }
  217. else if(month == 12 && day <= 21)
  218. {
  219. return "Sagittarius";
  220. }
  221. else if(month == 12 && day >= 22)
  222. {
  223. return "Capricorn";
  224. }
  225. else
  226. {
  227. return "PULA KURWA!";
  228. }
  229.  
  230. }
  231.  
  232. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement