Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

(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. image text in transcribed

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Design Query Formulation And Administration Using Oracle And PostgreSQL

Authors: Michael Mannino

8th Edition

1948426951, 978-1948426954

More Books

Students also viewed these Databases questions