public class Calendar { /** * 直接的可以查看效果 * @param args */ public static void main(String[] args) { int year=input.nextInt();//年 int month=input.nextInt();//月 int yearday=0;//年总天数 //计算从1900年到今年之间的时间 for (int i = 1900; i < year; i++) { //计算闰年的条件 if(i%4==0&&i%100!=0||i%400==0){ yearday=yearday+366; }else{ yearday=yearday+365; } } int day=0;//一个月的天数 int monthday=0;//今年一月到本月的天数 int sumday=0;//距离1900年的总天数 //计算今年一月到本月的天数 for (int i = 1; i <=month; i++) { switch(i){ case 1: case 3: case 5: case 7: case 8: case 10: case 12: day=31; break; case 2: if(year%4==0&&year%100!=0||year%400==0){ day=29; break; }else{ day=28; break; } default: day=30; break; } if(i
用java程序写日历_我用java写的日历
最新推荐文章于 2022-05-05 16:50:51 发布