2010-10-22 07:25:43 UTC
year.
Implement a class Year with the predicate method boolean isLeapyear().
public class Leapyear
{
private int Year;
private boolean isLeapyear;
/**
Constructs no Leapyear
*/
public Leapyear()
{
}
/**
Set the year.
@param the newYear of the Leapyear.
*/
public void setYear(int newYear)
{
Year = newYear;
}
/**
return the Leapyear
@return Year
*/
public int getYear()
{
return Year;
}
/**
Method for proving if it is a leap year or not
@return isLeapyear if it is leap year or not.
*/
public boolean isLeapyear(int Year)
{
if (Year % 4!=0)
{isLeapyear = false;
}
if((Year % 400 != 0 ) && (Year % 100 == 0))
{
isLeapyear = false;
}
else
{ isLeapyear = true;
}
}
return isLeapyear;
}
this is class that i created and i still dont know how to create the tester..
Im a heading to this. But still lost . Can you give me a feedback on what should be done inorder to run the program.
import java.util.Scanner;
public class Year
{
public static void main( String[] args);
int Year;
boolean isLeapyear;
System.out.print("Enter the year: ");
Year theLeapyear = new Year();
theLeapyear.setYear(2005);
theLeapyear.getisLeapyear();
System.out.println("it is a leapyear");
System.out.println("its is not a leapyear");
}
}