//第五章 143页
import java.util.Scanner;
public class PrintCalendar {
/*main method */
public static void main (String[] args) {
Scanner input = new Scanner (System.in);
//prompt the user to enter year
System.out.print("Enter full year (e.g., 2001): ");
int year = input .nextInt();
//prompt the user to earn month
System.out.print("Enter month as number between 1 and 12: ");
int month = input.nextInt();
//Print calendar for the month of year
printMonth (year, month);
}
//A stub for printMonth may look like this
public static void printMonth(int year, int month) {
System.out.print(month + " " + year);
}
//A stub for printMonth may look like this
public static void printMonthTitle(int year, int month) {
}
//A stub for getMonthTitle may look like this
public static void printMOnthBody( int year, int month ){
}
// A stub for getMonthName may look like this
public static String getMontName(int month){
return "juanuary";
}
//A stub for getMonthName may look like this
public static int getStartDay (int year, int month) {
return 1;
}
// A stub for getTitaNumberOfDays may look like this
public static int getTotalNumberOfDays(int year, int moth) {
return 10000;
}
// S stub for getNumberOfDaysInMonth may look like this
public static int getNumberOfDaysInMonth (int year, int month) {
return 31;
}
//A stub for getTotalNumberOfDay may look like this
public static boolean isLeapYear(int year ) {
return true; // A dummy value
}
}
(每日一java)PrintCalendar
最新推荐文章于 2023-06-17 21:48:14 发布
本文介绍了一个使用Java编写的简单程序,该程序可以接收用户输入的年份和月份,并打印出对应月份的日历。程序利用了Scanner类来获取用户的输入,并通过自定义的方法实现日历的打印。
PrintCalendar&spm=1001.2101.3001.5002&articleId=24692401&d=1&t=3&u=253482cc330e46359717f1f91d3de609)
494

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



