Create a program to input a month and year


Problem

The definition of a leap year is in the following:

1) The year can be evenly divided by 4;
2) If the year can be evenly divided by 100, it is NOT a leap year, unless;
3) The year is also evenly divisible by 400. Then it is a leap year.

A simpler way to say it is that if the year is divisible by 400 or if the year is both divisible by 4 and not divisible by 100, then it is a leap year.

A February in a leap year has 29 days, but a February not in a leap year has 28 days.
January, March, May, July, August, October, and December all have 31 days.
April, June, September and November all have 30 days.

Create a program to input a month and year (both as integers), then to output the number of days in the month, as in the following:

Enter a month: 2
Enter a year: 1900
2/1900 has 28 days.
or the following:
Enter a month: 2
Enter a year: 2016
2/2016 has 29 days.
or the following:
Enter a month: 10
Enter a year: 2017
10/2016 has 31 days.

Request for Solution File

Ask an Expert for Answer!!
JAVA Programming: Create a program to input a month and year
Reference No:- TGS03261556

Expected delivery within 24 Hours