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
  • 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 3: are instructions correct?

 
Ranch Hand
Posts: 328
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
In the Leap year rules it says the years evenly divisible by 4
excluding those divisible by 100 or 400 are leap years.(I thought it was just the 4-year thing myself!)
However in the examples it gives 2000 as an example of a leap year......
Comments??
I'd like to clear this up before getting nitpicked on the instructions rather than my feeble code:-)
Terry
 
Ranch Hand
Posts: 233
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Terry, The instructions are correct. 2000 is a leap year.
2000 / 4 = 500.
and
2000 / 100 = 20.
This blows the first check since 2000 is evenly divisible by both 4 and 100.
2000 / 400 = 5
However, this overrides the first check since 2000 is evenly divisible by 400. So 2000 is a leap year, just check a 2000 calendar
 
Terence Doyle
Ranch Hand
Posts: 328
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I don't want you to think I'm nitpicking ...that's for you guys...
This is the text on the web page
****************************************
Write a program that will read in a year and report if it is a leap year. The tricky thing here is that a leap year occurs:
on every year that is evenly divisible by 4
// that's the 4-group
except every year that is evenly divisible by 100
// doesn't except mean we should take out these ones???
except every year that is evenly divisible by 400.
**********************************************
My interpretation was that from the group of 4-divisible years we would have to extract those that were 100-divisible and 400-divisible.
I did express my surprise as I know 2000 is a leap year.

Terry
[This message has been edited by Terence Doyle (edited June 11, 2001).]
 
Sheriff
Posts: 9109
12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
>The tricky thing here is that a leap year occurs:
>on every year that is evenly divisible by 4
>// that's the 4-group

Yep.

>except every year that is evenly divisible by 100
>// doesn't except mean we should take out these ones???

Yep. Take them out.

>except every year that is evenly divisible by 400.

This over-rides the previous exception.

See the example in the Style Guide for further enlightenment.
 
Terence Doyle
Ranch Hand
Posts: 328
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Marilyn.
Too many hours indoors looking at a screen I suppose. :-))
I'd better get back to coding that one again.
Bye,
Terry
 
tumbleweed
Posts: 5089
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Terence Doyle:
In the Leap year rules it says the years evenly divisible by 4
excluding those divisible by 100 or 400 are leap years.(I thought it was just the 4-year thing myself!)


You obviously have not worked on a Y2K project
 
what if we put solar panels on top of the semi truck trailer? That could power this tiny ad:
Free, earth friendly heat - from the CodeRanch trailboss
https://www.kickstarter.com/projects/paulwheaton/free-heat
reply
    Bookmark Topic Watch Topic
  • New Topic