It's not a secret anymore!*
The moose likes Cattle Drive and the fly likes Leap assignment question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » This Site » Cattle Drive
Bookmark "Leap assignment question" Watch "Leap assignment question" New topic
Author

Leap assignment question

Nath Maniedeo
Greenhorn

Joined: Feb 15, 2008
Posts: 29
HI!

on the Leap assignment, it gives us this advice:

"on every year that is evenly divisible by 4
except every year that is evenly divisible by 100
except every year that is evenly divisible by 400" -

for a leap year calculation, this doesn't seem to take into account the year 2000 as a leap year...so my question is: is there a seperate calculation that's needed for only that year OR are the same calculations supposed to check the year 2000 as a leap year also??

(if this is confusing, I can try to clarify)

thanks for anyone that can help.

Nath
Marilyn de Queiroz
Sheriff

Joined: Jul 22, 2000
Posts: 9044
    
  10
2000 is evenly divisible by 4 which means that it is a leap year, but ...
2000 is evenly divisible by 100 which means that it is not a leap year, but ...
2000 is evenly divisible by 400 which means that it is a leap year.

Last line wins, so 2000 is a leap year.


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

Joined: Oct 04, 2007
Posts: 90
Hi Nath,

I believe this algorithm covers all cases, including the year 2000.
Divisible by 4? Yes. It could well be a leap year. But wait...
Divisible by 100? Yes. Oh, It's not a leap year. But wait...
Divisible by 400? Yes! It is a leap year after all!!!

Dick.

Oops... Marilyn's beat me to it (but at least we have the same story ).
[ April 02, 2008: Message edited by: Dick Summerfield ]
Nath Maniedeo
Greenhorn

Joined: Feb 15, 2008
Posts: 29
thanks to you both...ok I think I was understanding this wrong...I think you guys clarified it for me...perhaps some if statements...let me try again.

"on every year that is evenly divisible by 4
except every year that is evenly divisible by 100
except every year that is evenly divisible by 400"
 
 
subject: Leap assignment question
 
Similar Threads
Java-3 Leap Question
Leap Year
Assignment 1.3 - conflicting Specs.
1.3 question
Java 3 Leap