Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Date
- {
- private int day;
- private int month;
- private int year;
- public Date (int a,int b,int c){
- day = a;
- month =b;
- year =c;
- }
- privateintgetDay ()
- {
- return day;
- }
- privateintgetMonth(){
- return mounth;
- }
- privateintgetYear(){
- return year;
- }
- private void setYear(intYearToSet){
- this.year = YearToSet;
- }
- private void setMonth(intMonthToSet){
- MonthToSet=this.mounth;
- }
- private void SetDay(intDayToSet){
- DayToSet = this.day;
- }
- privateintCompareTo(Date other){
- if (year>other.year) {
- return 1;
- }
- if (year<other.year){
- if (month>other.month)
- return 1
- if (month<other.month)
- return -1;
- if(day>other.day)
- return 1
- if (day<other.day)
- return -1
- }
- return 0;
- 1 12 1997
- 2 12 1998
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement