• Register
Welcome to Kodlogs, programming questions and answer website.
0 votes
92 views

Problem:

which operation could we perform in order to find the number of milliseconds in a year

1- 60 * 60 * 24 * 7 * 365

2- 1000 * 60 * 60 * 24 * 365

3- 24 * 60 * 100 * 7 * 52

4- 1000 * 60 * 24 * 7 * 52

5 - None of these

by (550 points)  

1 Answer

0 votes

Solution:

Use the following abbreviations:

DAYS_YEAR = year,

HOURS_DAY = day,

MINUTES_HOUR = hour,

SECONDS_MINUTE = minute,

MILLIS_SECOND = second,

MILLISECONDS_YEAR = millisecond.

Then

Therefore, the correct calculation is

1000 * 60 * 60 * 24 * 365

Code would be

private static final long MILLISECONDS_IN_YEAR =

        (long)MILLIS_SECOND * SECONDS_MINUTE * MINUTES_HOUR

        * HOURS_DAY * DAYS_YEAR;

Answer: 1000 * 60 * 60 * 24 * 365

Final Note:

1 Year is usually equal to 31,556,952,000 Milliseconds

by (5.3k points)  
...