Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Leap Year  RSS feed

 
Holly Leery
Ranch Hand
Posts: 97
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok I am trying to find some information on how to disinquish leap years in a JOptionPane dialog box. Does anyone know where I could look to find some information on this so that I can study it to write part of a code? I am wanting to be able to tell a user yes this is a leap year or no this isn't a leap year, so i am thinking of using if else statements, what do you think?
 
Holly Leery
Ranch Hand
Posts: 97
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A leap year is one that can be divided by 4 evenly or 400 evenly, but not 100, right? But does it have to be divisable by both 4 and 400 or just either?
 
Holly Leery
Ranch Hand
Posts: 97
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ok ok i figured it out ...but i do have one more question. i want to continuously prompt the user to enter in years until they enter the number i specify to exit, so how do i get it to continuously prompt the user? any one have any ideas of where i coule read about this?
 
Dirk Schreckmann
Sheriff
Posts: 7023
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Loop while some condition is true.

Looping is a topic covered in any decent introductory programming material.

Here is a list of free on-line Java tutorials and books that I have found useful:
  • Sun's Java Tutorial
  • Introduction to Computer Science using Java by Bradley Kjell
  • Introduction to Programming Using Java by David J. Eck
  • Dick Baldwin's Java Programming Tutorials
  • Interactive Programming In Java by Lynn Andrea Stein
  • Bruce Eckel's Thinking In Java
  • JavaRanch's own Campfire Stories
  • Allen B. Downey's How To Think Like A Computer Scientist
  •  
    • Post Reply Bookmark Topic Watch Topic
    • New Topic
    Boost this thread!