当前位置: 首页 > news >正文

阿里云网站空间购买2022双11各大电商平台销售数据

阿里云网站空间购买,2022双11各大电商平台销售数据,个人门户网站,美橙互联网站建设进不去展开全部 /* 题目:输出任意年份任意月份的日历表(公元后) 思路e68a843231313335323631343130323136353331333361326239: 1.已知1年1月1日是星期日,1 % 7 1 对应的是星期日,2 % 7 2 对应的是星期一,以此类推; 2.计算当年以前所有天数当年当月1号之前所有天数; a.年份分平年闰年…

展开全部

/*

题目:输出任意年份任意月份的日历表(公元后)

思路e68a843231313335323631343130323136353331333361326239:

1.已知1年1月1日是星期日,1 % 7 = 1 对应的是星期日,2 % 7 = 2 对应的是星期一,以此类推;

2.计算当年以前所有天数+当年当月1号之前所有天数;

a.年份分平年闰年,平年365天,闰年366天;

b.闰年的判断方法year % 400 == 0 || (year % 100 != 0 && year % 4 == 0)若为真,则为闰年否则为平年;

c.定义平年/闰年数组,包含各月天数;

d.遍历数组求和,计算当年当月前总天数;

e.当年以前所有天数+当年当月前总天数+1即为1年1月1日到当年当月1日的总天数;

3.总天数对7取模,根据结果判断当月1号是星期几,输出空白区域;

4.输出当月日历表,逢星期六换行

*/

import java.util.Scanner;

class FindMonthList {

public static void main(String[] args){

Scanner sc = new Scanner(System.in);

System.out.println("请输入年份:");

int year = sc.nextInt();            //年份

if (year 

System.out.println("输入错误!");

return;

}

System.out.println("请输入月份:");

int month = sc.nextInt();            //月份

if (month  12) {        //判断非法输入月份

System.out.println("输入错误!");

return;

}

//输出表头

System.out.println("-------" + year + " 年 " + month + " 月 " + "-------");

System.out.println();

System.out.println("日  一  二  三  四  五  六");

//计算当前年份以前所有天数beforeYearTotalDay;每4年一个闰年,闰年366天,平年365天

int beforeYearTotalDay = ((year - 1) / 4 * 366) + (year-1 - ((year - 1) / 4)) * 365;

int[] arrLeapYear = {0,31,29,31,30,31,30,31,31,30,31,30,31};    //闰年各月天数    int数组

int[] arrNormalYear = {0,31,28,31,30,31,30,31,31,30,31,30,31};    //平年各月天数    int数组

int beforeMonthTotalDay = 0;                                    //定义本年当月之前月份的总天数

if (year % 400 == 0 || (year % 100 != 0 && year % 4 == 0)) {    //判断当前年份是否是闰年

for (int i = 0 ; i 

//计算当前月份之前的所有天数

beforeMonthTotalDay = beforeMonthTotalDay + arrLeapYear[i];

}

//判断当月1日是星期几

int totalDay = beforeYearTotalDay + beforeMonthTotalDay + 1;

int week = totalDay % 7;//已知1年1月1日是星期日,即模7得1对应的是星期日

for (int i = 0 ; i 

System.out.print("    ");//输出开头空白

}

for (int i = 1 ;i <= arrLeapYear[month] ;i ++ ) {    //for循环输出各月天数

System.out.print(i + "  ");

if (i 

System.out.print(" ");

}

if (i % 7 == ((7-(week - 1)) % 7 ) || i == arrLeapYear[month]) {//每逢星期六/尾数换行

System.out.println();

}

}

} else {        //不是闰年就是平年

for (int i = 0 ; i 

beforeMonthTotalDay = beforeMonthTotalDay + arrNormalYear[i];

}

//判断当月1日是星期几

int totalDay = beforeYearTotalDay + beforeMonthTotalDay + 1;

int week = totalDay % 7;//已知1年1月1日是星期日,即模7得1对应的是星期日

for (int i = 0 ; i 

System.out.print("    ");//输出开头空白

}

for (int i = 1 ;i <= arrNormalYear[month] ;i ++ ) {//for循环输出各月天数

System.out.print(i + "  ");

if (i 

System.out.print(" ");

}

if (i % 7 == ((7-(week - 1)) % 7 ) || i == arrNormalYear[month]) {//每逢星期六/尾数换行

System.out.println();

}

}

}

}

}

http://www.ds6.com.cn/news/68665.html

相关文章:

  • wordpress导航栏文字大小不一广州seo排名优化
  • 手机企业网站多少钱杭州网站优化搜索
  • 海阳做网站百度推广登录入口登录
  • 可以免费做推广的网站平台推广渠道
  • 河源市建设规划局网站百度手机导航官方新版
  • 汽车门户网站开发军事最新消息
  • 网站存储空间模板建站常规流程
  • 网上做任务的网站是真的吗营销策划公司简介
  • 影响网站排名的因素b站推广网站入口2023是什么
  • 电子商务网站运营与管理整站seo排名
  • 网站建设 网站设计seo关键词优化外包
  • 九江哪里做网站关键词推广怎么做
  • 做点心的网站小程序开发公司十大排名
  • 丹阳市住房建设管理局网站网络营销图片
  • 网站怎么做跳转链接下载关键词推广软件
  • 网站和新媒体建设方案域名注册网站系统
  • 论文网站开发站点推广是什么意思
  • html5网站模板下载推广赚钱app
  • 罗湖商城网站建设哪家效益快百度指数查询官网入口
  • 做网站一般工资如何竞价排名是什么
  • 家居网站建设营销推广上海做关键词推广企业
  • 江西响应式网站制作短信营销
  • 十堰企业网站制作公司cpa游戏推广联盟
  • 网站做兼容处理怎么设置谷歌网站收录提交入口
  • 网站推广过程叙述徐州seo推广优化
  • 装修设计费收费标准处理事件seo软件
  • 做网站前期了解客户什么需求网站查询关键词排名软件
  • 哪些企业合适做网站整站seo外包
  • 政府网站建设投标书网上做推广怎么收费
  • 北京云建站模板武汉今日新闻头条