Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Leap year 2000

 
Donald R. Cossitt
buckaroo
Ranch Hand
Posts: 401
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It has been indicated that every year divisable by four evenly is a leap year with exception of those years evenly divisable by 100 & 400, which are themselves evenly divisible by all.
The year 2000 is evenly divisible by 4, 100 & 400; yet it indeed was a leap year. Is the Leap year excersize one of reality or just for grins?
doco
 
Barry Gaunt
Ranch Hand
Posts: 7729
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is the Leap year excersize one of reality or just for grins?

The last word should be groans, not grins
Yes doco mate, it's serious, because you gotta get it past the nitpickers, and nothing is more serious than that.
Take a look at previous groans in this forum. It's also instructive to search the web.
For 2000 look at it this way (in sequence):
2000 is divisible by four so it could be a LY.
2000 is divisible by 100 so it may not be a LY.
2000 is divisible by 400 so it is/was a LY.
[ March 01, 2003: Message edited by: Barry Gaunt ]
[ March 01, 2003: Message edited by: Barry Gaunt ]
 
Donald R. Cossitt
buckaroo
Ranch Hand
Posts: 401
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Actually, I did some research on Leap year and it seems most calculations are performed with the year 1582 as it's base. That kind of threw me for a loop until I realized the pattern is as you quite eloqently stated, what is actually being done for any year BC ? AD. There are about a half dozen paradigms for calculation not the least of which is one used by the US military and considtered to be the most accurate (365.2421875 days), which adds an additional cycle of 3200 years to the comparison.
By the way, using the US calcualation, I came up with 26 lines for finished product including the additional 3200 year cycle. And if opening opening braces were placed at the end of declaration, 21 would be the count. Can't wait to have it 'nitpicked'. :roll:
Which brings up a question: when counting lines I am assuming class header text and the like, is not being included in the count?
Thanks
doco
 
Marilyn de Queiroz
Sheriff
Posts: 9065
12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by doco mastadon:
Actually, I did some research on Leap year and it seems most calculations are performed with the year 1582 as it's base. That kind of threw me for a loop until I realized the pattern is as you quite eloqently stated, what is actually being done for any year BC ? AD. There are about a half dozen paradigms for calculation not the least of which is one used by the US military and considtered to be the most accurate (365.2421875 days), which adds an additional cycle of 3200 years to the comparison.


You can ignore the complications of the leap year issue for this assignment and just stick with the simplified calculations.

Which brings up a question: when counting lines I am assuming class header text and the like, is not being included in the count?

All lines are being included in the count. However, I think line count is not important. Readability is important.

What we're looking for is clean, elegant, easy to understand solutions. Focus on that. Not on line count.
 
Donald R. Cossitt
buckaroo
Ranch Hand
Posts: 401
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Marilyn;

All lines are being included in the count. However, I think line count is not important. Readability is important.
What we're looking for is clean, elegant, easy to understand solutions. Focus on that. Not on line count.

I know that; and will no doubt have may pointers from y'all when I eventually can post my code (waiting for delivery of the suggested text). I just view mentors' line counts as a bit of a challenge and am excited to get started.
doco
 
jason adam
Chicken Farmer ()
Ranch Hand
Posts: 1932
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by doco mastadon:
And if opening opening braces were placed at the end of declaration, 21 would be the count. Can't wait to have it 'nitpicked'. :roll:
Thanks
doco


Read the Style Guide carefully, most of the first assignments aren't ruthlessly nitpicked for programmatic errors (though those do creep in there), but for style issues. Have that thing open with you at all times going through the first assignments. Check, re-check, tripe check. Will make life easier on all of us in the long run
 
Marc Peabody
pie sneak
Sheriff
Posts: 4727
Mac Ruby VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I haven't learned the logic of leap year since elementary school, but as I remember it, years evenly divisible by 400 ARE leap years. The following code should illustrate this process:
******
Ooops! Had to remove my code - forgot which thread I was in!
******
Explaining it without code...
#1) years evenly divisible by 400 ARE leap years no matter what
#2) years evenly divisible by 100 ARE NOT leap years except for those that apply to rule #1
#3) years evenly divisible by 4 that are not ruled by rules #1 or #2 ARE leap years
#4) all other years ARE NOT leap years
Hope this helps.
[ March 02, 2003: Message edited by: Marc Peabody ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic