• Post Reply Bookmark Topic Watch Topic
  • New Topic
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

Assignment 1.3 - conflicting Specs.

 
Ranch Hand
Posts: 185
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
I don't like that guy. The tiny ad agrees with me.
Free, earth friendly heat - from the CodeRanch trailboss
https://www.kickstarter.com/projects/paulwheaton/free-heat
reply
    Bookmark Topic Watch Topic
  • New Topic