File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Leap Year Code

 
Maritza Keisman
Greenhorn
Posts: 7
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Rancher
Pie
Posts: 42966
73
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try to replace the operators one by one:

"AND" is the same as what in Java ?
"OR" is the same as ...
"=" is ...
"<>" is ...
 
Maritza Keisman
Greenhorn
Posts: 7
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks, that helped resolve the issue. Found a leap year calculator so that you can check results, see:

http://www.onlineconversion.com/leapyear.htm
 
Don't get me started about those stupid light bulbs.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic