java hosting


horseright.gif (6904 bytes) drivehead.gif (2283 bytes) cowleft.gif

Assignment Java-3 (Leap)

Purpose: To learn to use boolean logic and proper commenting.

Write a program that will read in a year and report if it is a leap year. The tricky thing here is that a leap year occurs:

    on every year that is evenly divisible by 4

      except every year that is evenly divisible by 100

        except every year that is evenly divisible by 400.

In other words, I want to type

     java Leap 2000
  

and see

     leap year!
  

or, if I type

     java Leap 2001
  

I want to see

     not a leap year!
  

Everything you need to know to do this assigment was covered in previous assignments.

Instructor's solution:

    31 total lines


Good for you! Now that you have tied up this assignment, lasso the next one.




Page maintained by Marilyn de Queiroz