File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Cattle Drive and the fly likes Leap year 2000 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » This Site » Cattle Drive
Bookmark "Leap year 2000" Watch "Leap year 2000" New topic
Author

Leap year 2000

Donald R. Cossitt
buckaroo
Ranch Hand

Joined: Jan 31, 2003
Posts: 401
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


doco
Barry Gaunt
Ranch Hand

Joined: Aug 03, 2002
Posts: 7729
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 ]

Ask a Meaningful Question and HowToAskQuestionsOnJavaRanch
Getting someone to think and try something out is much more useful than just telling them the answer.
Donald R. Cossitt
buckaroo
Ranch Hand

Joined: Jan 31, 2003
Posts: 401
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

Joined: Jul 22, 2000
Posts: 9052
    
  12
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.


JavaBeginnersFaq
"Yesterday is history, tomorrow is a mystery, and today is a gift; that's why they call it the present." Eleanor Roosevelt
Donald R. Cossitt
buckaroo
Ranch Hand

Joined: Jan 31, 2003
Posts: 401
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

Joined: May 08, 2001
Posts: 1932
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

Joined: Feb 05, 2003
Posts: 4727

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 ]

A good workman is known by his tools.
 
wood burning stoves
 
subject: Leap year 2000