Posted by: Slackdemic September 29, 2006
Java Help
Login in to Rate this Post:     0       ?        
Lootekukur, I copied and pasted your logic; it didn't work. (And, it looks correct to me when I just see the code. I didn't take C or C++ before taking this class; although, if/else doesn't ruin my present life, it greatly confuses me time and again.) Here's what I said about leap year: 1. Anything divisible by 4 is leap year. 2. BUT if it is not leap year if it is divisible by 100. 3. It is leap year if it is divisible by 100 and 400. If you omit "if" after BUT, I think it gives sense. You wrote this: 1. Anything divisible by 4 is leap year. -----NO 2. BUT if it is not leap year if it is divisible by 100. 3. It is leap year if it is divisible by 100 and 400. I think you are incorrect in #1. Something that is divisible by 4 IS leap year UNLESS it is also divisible by 100! To sum up all three #s: Anything divisible by 4 IS leap year UNLESS it is NOT divisible by 100. BUT, it IS leap year if it is divisible by 100 AND 400. Sajhauser, I juxtaposed the code I had with the code you claimed it was mine; and which really was, and I got more mixed up. This is what I just did. if (y % 4 ==0 && y % 100 != 0 || y%100 == 0 && y % 400 == 0) return true; else return false; Do you all buy it that logic? Let me know!
Read Full Discussion Thread for this article