class Date
{
public int month; // store the month
public int day; // store the day
public int year; // store the year
/**********************************
* constructors
***********************************/
/**********************************
* set methods (setters)
***********************************/
public void setMonth(int m)
{
month = m;
}
public void setday(int day)
{
day= m;
}
public void setyear(int year);
public void setyear (int year)
{
year = m;
}
/**********************************
* get methods (getters)
***********************************/
public int getMonth() { return month;}
public intgetDay () {return day;}
public intgetYear() {return year;}
/**********************************
* initialize methods
***********************************/
public boolean calcLeapYear()
{
boolean isLeapYear = true;
if(year %400 == 0
{isLeapYear = true;}
if(year % 100 == 0
{isLeapYear false;}
if (year % 4 == 0
{ isLeapYear true;}
else
{isLeapYear false;}
}
}class TestDate
{
public static void main (String args[])
{
Date d1;
d1 = new date();
Date d2 = new Date();
System.out.println("month is " +d1.getMonth());
System.out.println("day is " +d1.getDay());
System.out.println("year is " +d1.getYear());
d1.setMonth(11);
d1.setDay (11);
d1.setYear(1999);
System.out.println("month is " +d1.getMonth());
System.out.println("day is " +d1.getDay());
System.out.println("year is " +d1.getYear());
}
}
{
public int month; // store the month
public int day; // store the day
public int year; // store the year
/**********************************
* constructors
***********************************/
/**********************************
* set methods (setters)
***********************************/
public void setMonth(int m)
{
month = m;
}
public void setday(int day)
{
day= m;
}
public void setyear(int year);
public void setyear (int year)
{
year = m;
}
/**********************************
* get methods (getters)
***********************************/
public int getMonth() { return month;}
public intgetDay () {return day;}
public intgetYear() {return year;}
/**********************************
* initialize methods
***********************************/
public boolean calcLeapYear()
{
boolean isLeapYear = true;
if(year %400 == 0
{isLeapYear = true;}
if(year % 100 == 0
{isLeapYear false;}
if (year % 4 == 0
{ isLeapYear true;}
else
{isLeapYear false;}
}
}class TestDate
{
public static void main (String args[])
{
Date d1;
d1 = new date();
Date d2 = new Date();
System.out.println("month is " +d1.getMonth());
System.out.println("day is " +d1.getDay());
System.out.println("year is " +d1.getYear());
d1.setMonth(11);
d1.setDay (11);
d1.setYear(1999);
System.out.println("month is " +d1.getMonth());
System.out.println("day is " +d1.getDay());
System.out.println("year is " +d1.getYear());
}
}