fred rosenberger wrote:Can you tell me what conditions you will ever reach line 20?

That is possible when you use the "Project leader calendar". Then you can be done about 100 years before you start... ;)

Campbell Ritchie

Sheriff

Posts: 55366

157

posted 6 years ago

Nice one! But you need to be done 300 years before you start in this case.

Actually, that is one error the compiler probably cannot catch.

John Jai

Rancher

Posts: 1776

posted 6 years ago

fred rosenberger wrote:
Can you tell me what conditions you will ever reach line 20?
That is possible when you use the "Project leader calendar". Then you can be done about 100 years before you start... ;)

Nice one! But you need to be done 300 years before you start in this case. Actually, that is one error the compiler probably cannot catch.

Please explain these comments not able to decipher them

Asha Dore

Greenhorn

Posts: 10

posted 6 years ago

Got the format right I think.

I changed it quite a bit after further reading. The program compiles and the tester runs. Everything works at this point except the output for a leap year is still saying that it's not a leap year. I'm thinking my arithmetic is way off. Or some other major issue that I'm missing

}

Campbell Ritchie

Sheriff

Posts: 55366

157

posted 6 years ago

John Jai wrote: . . . Please explain these comments . . .

Do you really need an explanation?

John Jai

Rancher

Posts: 1776

posted 6 years ago

Check the leap year condition - i am not confident though (not thoroughly tested )

So, no matter what the original condition was, we would return from the method in either the 'if' or the 'else' block. There was no way to ever get past it without returning, so the 'line 20' is unreachable.

I think the other comments were jokes about Project Managers setting unrealistic completion dates

There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors

Asha Dore

Greenhorn

Posts: 10

posted 6 years ago

John Jai wrote:Check the leap year condition - i am not confident though (not thoroughly tested )

Do you really need an explanation?

Yes

Thank you SO much. That totally works. And will help me with my arithmetic in the future.

Campbell Ritchie

Sheriff

Posts: 55366

157

posted 6 years ago

John Jai wrote: . . .

Do you really need an explanation?

Yes

You can't explain a joke.

And try (i & 3) == 0 instead of i % 4 == 0. I'll let you work out why, but it will give slightly faster execution.