class A
{
int yr;
A ( int yr )
{
this.yr = yr;
}
int IsLeap ()
{
if ( yr%400 == 0 )
return (0);
else if ( yr%4 == 0 )
return (1);
else
return (2);
}
}
class Leap
{
public static void main ( String args[] )
{
int y;
y = Integer.parseInt ( args[0] );
A a = new A ( y );
int r = a.IsLeap();
if ( r==0 )
System.out.println("\n\n" + y + " is a Century Leap Year\n");
else if ( r==1 )
System.out.println("\n\n" + y + " is a Leap Year\n");
else
System.out.println("\n\n" + y + " is not a Leap Year\n");
}
}
No comments:
Post a Comment