Simple it checks how many leap years exists between the current year that is passed as parameter and Y.

Then it adds up all the days of the month for the calender year.

Then it calculates the days in the year, month and week.

Then it displays them all through the display function by getting the array.