Question: Help in java coding Lab 4: Module 4 - Selection Lab The Gregorian calendar is a solar calendar with 12 months of 28-31 days each.

Help in java codingHelp in java coding Lab 4: Module 4 - Selection Lab The

Lab 4: Module 4 - Selection Lab The Gregorian calendar is a solar calendar with 12 months of 28-31 days each. The year consists of 365 days, with a leap day being added to February in the leap years. A leap year normally occurred every 4 years, except when the century is changed. ("Gregorian calendar", Wikipedia) The following table shows the length of the days for each month. No. 1 2 3 4 5 6 7 8 9 10 11 12 Month Length in days January 31 February 28 or 29 March 31 April 30 May 31 June 30 July 31 August 31 September 30 October 31 November 30 December 31 Any year that is divisible by 4 is a leap year. Except the year that is divisible by 100 (for example, 1900) is a leap year only if it is also divisible by 400. For this reason, the following years are not leap years even though they are divisible by 4: 1700, 1800, 1900, 2100, 2200, 2300, 2500, 2600 Write a Java program that accepts the number for a month and a year, then prints the number of days in that month. For example, if the user enters 2 as the month and 2020 as the year number, the output should be "February in 2020 is 29 days" But if the user enters 2 as the month and 2100 as the year number, the output should be "February in 2100 is 28 days" Tip: you should first evaluate if the given year is a leap year or not. This will determine the number of days if the selected month is February

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!