Advertisement
Parasect

123123

Sep 9th, 2014
221
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.73 KB | None | 0 0
  1. public class Date
  2. {
  3. private int day;
  4. private int month;
  5. private int year;
  6.  
  7. public Date (int a,int b,int c){
  8. day = a;
  9. month =b;
  10. year =c;
  11.  
  12. }
  13. privateintgetDay ()
  14. {
  15. return day;
  16.  
  17. }
  18. privateintgetMonth(){
  19.  
  20. return mounth;
  21. }
  22. privateintgetYear(){
  23. return year;
  24. }
  25. private void setYear(intYearToSet){
  26. this.year = YearToSet;
  27. }
  28. private void setMonth(intMonthToSet){
  29. MonthToSet=this.mounth;
  30. }
  31. private void SetDay(intDayToSet){
  32. DayToSet = this.day;
  33. }
  34. privateintCompareTo(Date other){
  35. if (year>other.year) {
  36. return 1;
  37. }
  38. if (year<other.year){
  39. if (month>other.month)
  40. return 1
  41. if (month<other.month)
  42. return -1;
  43. if(day>other.day)
  44. return 1
  45. if (day<other.day)
  46. return -1
  47. }
  48. return 0;
  49.  
  50. 1 12 1997
  51. 2 12 1998
  52. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement