public static void topPrint(char[] week) { //输出顶部日历表头
for (int i=0;i<week.length;i++){
System.out.print(week[i]+"\t");
}
System.out.println();
}
public static int tianShu(int yueFen,int nian) { //判断月的天数,以作累加之用
int ts;
switch (yueFen){
case 1: //1,3,5,7,8,10,12月是31天用case贯穿!
;
case 3:
;
case 5:
;
case 7:
;
case 8:
;
case 10:
;
case 12:
ts=31;
break;
case 4: //4,6,9,11月是30天用case贯穿下
;
case 6:
;
case 9:
;
case 11:
ts=30;
break;
case 2: //二月比较特殊所以要判断是否是润年!
if (nian%4==0&&((nian%100!=0)||(nian%400==0))){
ts=29;
}else ts=28;
break;
default:
ts=0;
}
return ts; //返回月的天数
}
public static int printweek(int x){ //计算星期数
return ((x+5)%7); //以0年0月0日是星期1的基础上进行纠正