Question: JAVA PROGRAMMING Introduction to Programming Using Java Write a program that prompts the user to enter a month (1-12) and a year (e.g., 2012), and
JAVA PROGRAMMING
Introduction to Programming Using 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:
Method Description
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. Note this only works for the 1st day of the month.
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.
. You must write the code for the remaining methods. Be sure to clearly document your code and your methods.
2. Write a program that prompts the user to specify a year (e.g., 2012) and then displays a calendar for each month in that year. You must reuse the methods from part one
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
