Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Assignment 1.3 - conflicting Specs.

 
Shama Khan
Ranch Hand
Posts: 185
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Assignment wording:
a leap year occurs 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.
>java Leap 2000
>leap year!

My words: The way I am reading the specs, the year 2000 shouldn't be a leap year because eventhough it's divisible by 4, it is also divisible by 100 and 400!
so is the year 100 or 400 a leap year or not?
I read the specs so many times before finally posting this!
Shama
 
Rosie Suayan
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
2000 is divisible by 4 therefore it is a leap year,
but 2000 is divisible by 100 so it's not a leap year,
but 2000 is divisible by 400 so it is a leap year.
A leap year happens every 4 years. But years divisible by 100 aren't leap years unless they are also divisible by 400.
Hope that sort of clears it up?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic