µ±Ç°Î»ÖãºÊ×Ò³ > ʵÑéÒ» Java³£Óù¤¾ßÀà±à³Ì
}
ÆäÖÐpart±íʾ¼ÓÄĸö²¿·Ö£¬Ä꣬Ô»¹ÊÇÈÕ£¬nums±íʾ¼Ó¶àÉÙ?
Èç:d1.addDate(1,10);±íʾ¼ÓÉÏ10Ä꣬d1.addDate(2,10);±íʾ¼ÓÉÏ10Ô£¬
d1.addDate(3,10);±íʾ¼ÓÉÏ10Ìì¡£
²Î¿¼£º¿ÉÒÔ¶¨ÒåÒ»¸ö˽Óк¯Êý£¬½«ÈÕÆÚ¼ÓÒ»ÌìºóµÄÈÕÆÚ 3£©¡¢¶¨ÒåÈÕÆÚ²îº¯Êý¿ÉÒÔÏà²î¶àÉÙÄ꣬Ô£¬ÈÕ¡£
public int diffDate(int part,Date date){
¡
}
Èç:d1. diffDate (1,d2);±íʾd1Óëd2Ïà²î¶àÉÙÄê¡£d1. diffDate (2,d2);±íʾd1Óëd2Ïà²î¶àÉÙÔ¡£d1. diffDate (3,d2);±íʾd1Óëd2Ïà²î¶àÉÙÌì¡£ 4£©¡¢¼ÆËãÊä³öµ±Ç°ÈÕÆÚʵÀý¶ÔÓ¦µÄÊÇÐÇÆÚ¼¸º¯Êý
public int calcuWeekDay(){
¡.
}
×¢Ò⣺¿¼Âǵ½1900-1-1ÈÕÕâÒ»ÌìÊÇÐÇÆÚÒ»µÄÏÖʵ.
package job1;
import java.text.SimpleDateFormat; import java.util.Date;
public class MyDate { private int year; private int month; private int day; public MyDate(){}
public MyDate(int year,int month,int day){ }
public int getYear(){
this.year=year; this.month=month; this.day=day;
}
return this.year;
public void setYear(int year){ }
public int getMonth(){ }
public void setMonth(int month){ }
public int getDay(){ }
public void setDay(int day){ }
private void addOneMonth(){ }
this.month++; if(this.month>12){ }
this.year++; this.month=1; this.day=day; return this.day; this.month=month; return this.month; this.year=year;
private void addOneDay(){ }
public int maxMonthDays(){ }
int monthDays=31;
if(this.month==4||this.month==6||this.month==9||this.month==11){ }
else if(this.month==2&&isLeapYear()){ }
else if(this.month==2&&!isLeapYear()){ }
return monthDays;
monthDays=28; monthDays=29; monthDays=30; this.day++;
if(this.day>maxMonthDays()){ }
this.month++; this.day=1;
if(this.month>12){ }
this.year++; this.month=1;
private boolean isLeapYear() { }
public String toString() { }
public void addDate(int part,int nums){ }
if(part==1){ }
else if(part==2){ }
else if(part==3){ }
for(int i=0;i addOneDay(); for(int i=0;i addOneMonth(); this.year=this.year+nums; return this.year + \Äê\ÔÂ\ÈÕ\if(this.year%4==0&&this.year0!=0||this.year@0==0) return true; return false;
¹²·ÖÏí92ƪÏà¹ØÎĵµ