Step 4:

Create a copy of the app
Check02W.java and call it Check02X.java

In the prior step, when calculated the number of years that have elapsed since 1970, the number was an integer. However, we are partway through the year. There should be a fractional component. Change the divisor from
365 to 365.0. You will need to change the declaration of yrsElapsed from long to double. Print out the new value to the console.

Pasted Graphic 1


In the prior step, we assumed that there are generally 365 days per year. However, since 1970, there were 9 leap years (a leap year is a year that has 366 days instead of 365 days). So on average, there were
365.225 days per year. Declare a new variable yrsElapsedLY and use it to store the number of years elapsed since Jan 1, 1970 that takes into account leap years. The difference between the two values works out to about 9 days.

Print the new value to the console as shown below:

Pasted Graphic 2