package Day8_06;

import java.util.*;

public class ClassTest {
public static void main(String[] args) {
System.out.print("请输入年:");
Scanner s1 = new Scanner(System.in);
int Year = s1.nextInt();
System.out.print("请输入月:");
Scanner s2 = new Scanner(System.in);
int Mon = s2.nextInt();
System.out.print("请输入日:");
Scanner s3 = new Scanner(System.in);
int Day = s3.nextInt();
int sum = 0; switch(Mon){
case 12:sum += 30;
case 11:sum += 31;
case 10:sum += 30;
case 9 :sum += 31;
case 8 :sum += 31;
case 7 :sum += 30;
case 6 :sum += 31;
case 5 :sum += 30;
case 4 :sum += 31;
case 3 :
if((Year % 4 == 0 && Year % 100 != 0) || (Year % 100 == 0 && Year % 400 == 0)){
System.out.println("这一年是闰年!");
sum += 29;
}
else{
System.out.println("这一年是平年!");
sum += 28;
}
case 2 :sum += 31;
case 1 :sum += Day;
}
System.out.println(Year + "年" + Mon + "月" + Day + "日,是这一年的第:" + sum + "天");
}
}
05-11 17:01
查看更多