Question: (JAVA)Use a variable to accept and store user input. This variable will be a number representing the month. Ex. Jan = 1, Feb =2, Mar

(JAVA)Use a variable to accept and store user input. This variable will be a number representing the month. Ex. Jan = 1, Feb =2, Mar =3, Your code will figure out and display the name of the, the number of days in that month and for Feb ask the user to input the year and display a message whether it is a leap year or not how many days, hours, min and sec as shown in the sample output below. (JAVA)Use a variable to accept and store user input. This variable will

i. Extra credit: figure out the best way to accept user input to help you determine whether this is a leap year or not. Based on the result, display February as 28 or 29 days with its corresponding number of seconds.

ii. Extra credit: Odd numbered months have 31 days until you get to July, then starting with August even numbered months have 31 days. How can you make your code more efficient as not having to write 12 if conditions?

Hint: A leap year is any year divisible by four except those years divisible by 100 unless the year is also divisible by 400. You could modify your code to accept user input for the year and use the expression in the book to determine leap year.

DaysHrsSec [Java Applicationl C:1Program FilesJava idk1.8.0 144\bin iavaw.ex Enter the Month: 1 Month Name is: Jarn Jan has 31 days744 Hrs, 44640 Min, 2678400 Sec. DaysHrsSec [Java Applicationl C:1Program FilesJava idk1.8.0 1441biniavaw. Enter the Month: 2 Enter the year? (YYYY) 1900 1900 is NOT a leap year Month Name is: Feb Feb has 28 days672 Hrs, 40320 Min, 2419200 Sec. DaysHrsSec [Java Applicationl C:1Program FilesJava idk1.8.0 144\bin iavaw. Enter the Month: 2 Enter the year? (YYYY) 2000 2000 is a leap year Month Name is: Feb Sep has 29 days696 Hrs, 41760 Min, 2505600 Sec. DaysHrsSec [Java Applicationl C:1Program FilesJava idk1.8.0 144bin iavaw.e Enter the Month: 6 Month Name is: Jun Jun has 30 days720 Hrs, 43200 Min, 2592000 Sec

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!