Question: Java Write a program that prompts the user to enter a month (1-12) and a year (e.g., 2012), and then displays a calendar for that
Java
Write a program that prompts the user to enter a month (1-12) and a year (e.g., 2012), and then displays a calendar for that month and year as illustrated below:
Your program must use the following methods:
void printMonthCalendar( int m, int y ) Displays a calendar like the one above for a specified month and year.
void printMonthHeader( int m, int y ) Displays the header information ( month, year, line separator, 3-character day names) for a calendar.
void printMonthBody( int m, int y ) Displays the days in the calendar associated with the corresponding days of the week.
String getMonthName( int m ) Returns the name of the month for a specified month number (e.g., returns March for m=3).
int getStartDay( int m, int d, int y ) Returns the day of week number (1=Monday,, 7= Sunday) for the specified month, day, and year.
int getNumDaysInMonth( int m, int y) Returns the number of days in a specified month and year. Leap years are accounted for.
boolean isLeapYear( int y ) Returns true if the specified year is a leap year, and returns false otherwise.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
