本题要求实现一个方法,可计算从1800年1月1日开始到用户输入的年代+月份的所有天数。例如用户输入2020,10,则计算从1800年1月1日开始,到2020年9月30日截止,一共多少天。
在这里给出方法被调用进行测试的例子。如下所示:
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
int year = input.nextInt();
int month = input.nextInt();
System.out.println(getTotalNumberOfDays(year, month));
}
/* 请在这里填写答案 */
}
public static int getTotalNumberOfDays(int year, int month)
{
计算从1800年到指定年月的总天数

该方法旨在计算从1800年1月1日起到用户指定的年月为止的总天数,例如输入2020年10月,即计算至2020年9月30日的天数。
最低0.47元/天 解锁文章
1301

被折叠的 条评论
为什么被折叠?



