Meaningless Drivel is fun!*
The moose likes Cattle Drive and the fly likes Leap Year Code Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » This Site » Cattle Drive
Bookmark "Leap Year Code" Watch "Leap Year Code" New topic
Author

Leap Year Code

Maritza Keisman
Greenhorn

Joined: Mar 28, 2006
Posts: 7
I fouund code on the internet which would satisfy the leap year coding requirements Assignment:

lp = ((y % 4 = 0) AND (y % 100 <> 0)) OR (y % 400 = 0)

However, I am having a lot of difficulty translating this into Java. Keep on getting a lot of syntax errors. I have tried various iterations and keep on getting compile errors.

Many thanks.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41106
    
  45
Try to replace the operators one by one:

"AND" is the same as what in Java ?
"OR" is the same as ...
"=" is ...
"<>" is ...


Ping & DNS - my free Android networking tools app
Maritza Keisman
Greenhorn

Joined: Mar 28, 2006
Posts: 7
Thanks, that helped resolve the issue. Found a leap year calculator so that you can check results, see:

http://www.onlineconversion.com/leapyear.htm
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Leap Year Code
 
Similar Threads
unreachable statement error
Leap year program
two puzzling errors
please verify this code
Leap Year program