import java.util.Scanner;
class CalendarMain
{
//主函數入口
public static void main( ****請輸入日期(格式如: 2011-01)*****");
Scanner sc = new Scanner(System.in);
String ym = sc.next(); String[] yearMonth = ym .split("-");
//將字串轉換為整數
int year = Integer.parseInt Year.fun (year);
Month.fun(month,year);
}
}
//取得閏年0;
public static void fun (int year){
if(year > 1990 && year ear % 4 == 0 && year % 100 != 0 || (year % 400 == 0 )){
leapYear ++;
}
}else{
為 }
}
//取得一個月幾天及總天數
class Month
{
public static void fun(int month,int year){
int days = y .leapYear + (year - 1990)*365;
if(month > 0 && month if(i days += i % 2 == 1 ? 31 :30;
30;
}
= = 1 ? 30 :31;
monthDay = i % 2 == 1 if(i == 2){
我(year % 400 ==0 )){
days += 28; ;
}else{
monthDay = 28;
} }
Show.mothed(days,monthDay );
}else{
System.out.println("請輸入正確的月份!");
}
}
}
//顯示日曆
class Showoidp. //加一表示從星期一開始
int week = (days - monthDay) % 7 + 1;
System.out.println("n"+" t週四"+"t週五"+"t週六");
for (int i = 1;i System.out .print(" "+"*"+"t");
}else{
System.out.print(" "+(i-week)+"t" );
}else{
}
}
System.out.print("n") ;
}
}
}
}