• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Cattle Drive problem 3

 
Aman Singh
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Folks,

Could you please hint me with what am I doing wrong with this problem.





[edit: we do not allow students to post actual code for the Cattle Drive, since it would deprive other students of learning opportunities]
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please see ItDoesntWorkIsUseless and TellTheDetails.

You might want to look up how to calculate a leap year, too.
 
Henry Wong
author
Marshal
Pie
Posts: 21417
84
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

There some very specific rules when working with the cattle drive -- of which I am not sure if you are violating them.

Regardless, this topic is being moved to the cattle drive forum, to be sorted out there.

Henry
 
Aman Singh
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
@ David,

I am trying to satisfy these three conditions:

Leap 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.
 
Gary Ba
Ranch Hand
Posts: 161
Firefox Browser Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Check this thread out on Cattle Drive. It should help you with the requirements and hopefully the code.

"Different way of thinking about Leap"
 
Aman Singh
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Gary,

Thanks for the help. I will read it. I came up with this, Am I anywhere close?




[edit: we do not allow students to post actual code for the Cattle Drive, since it would deprive other students of learning opportunities]
 
Gary Ba
Ranch Hand
Posts: 161
Firefox Browser Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes you are close. You need to know what a leap year is first. Your rules are not correct. Carefully read through the thread that I mentioned. Also, send your code to your nitpicker, he/she will be able to guide you.
 
Katrina Owen
Sheriff
Posts: 1367
18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Aman, welcome to the Cattle Drive!

I've edited your posts to take out the actual code, since we want each student to come up with their own solution.

Do feel free to ask questions about problems you encounter. You can use pseudocode to help explain what you are wondering about.

Regards,
Katrina
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic