Last week, we had the author of TDD for a Shopping Website LiveProject. Friday at 11am Ranch time, Steven Solomon will be hosting a live TDD session just for us. See for the agenda and registration link
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
• Campbell Ritchie
• Paul Clapham
• Ron McLeod
• Jeanne Boyarsky
• Tim Cooke
Sheriffs:
• Liutauras Vilda
• paul wheaton
• Henry Wong
Saloon Keepers:
• Tim Moores
• Tim Holloway
• Stephan van Hulst
• Carey Brown
• Frits Walraven
Bartenders:
• Piet Souris
• Himai Minh

# Leap assignment question

Greenhorn
Posts: 29
• Number of slices to send:
Optional 'thank-you' note:
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

Sheriff
Posts: 9109
12
• Number of slices to send:
Optional 'thank-you' note:
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.

Ranch Hand
Posts: 90
• Number of slices to send:
Optional 'thank-you' note:
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
Posts: 29
• Number of slices to send:
Optional 'thank-you' note:
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"

 Arthur, where are your pants? Check under this tiny ad. free, earth-friendly heat - a kickstarter for putting coin in your pocket while saving the earth https://coderanch.com/t/751654/free-earth-friendly-heat-kickstarter