Java Reference
In-Depth Information
printCalendar
(main)
readInput
printMonth
printMonthTitle
printMonthBody
getMonthName
getStartDay
getTotalNumberOfDays
getNumberOfDaysInMonth
isLeapYear
F
IGURE
6.11
The structure chart shows the hierarchical relationship of the subproblems in
the program.
let
printMonth
display the year and the month in the stub. Thus, your program may begin
like this:
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., 2012): "
);
int
year = input.nextInt();
// Prompt the user to enter month
System.out.print(
"Enter month as a number between 1 and 12: "
);
int
month = input.nextInt();
// Print calendar for the month of the 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 printMonthTitle may look like this */
public static void
printMonthTitle(
int
year,
int
month){
}
/** A stub for getMonthBody may look like this */
public static void
printMonthBody(
int
year,
int
month){
}
Search WWH ::
Custom Search