I spent hours thinking about this. I need to write 2 methods. before and after. after can use ONLY the before method. I wrote the code:
public boolean before(Date d)
{
if(getYear()<d.getYear() || (getYear()==d.getYear() && getMonth()<d.getMonth())
|| (getYear()==d.getYear() && getMonth()==d.getMonth() && getDay()<d.getDay()))
{
return true;
}
return false;
}
and then:
public boolean after(Date d)
{
if(!before(d))
{
return true;
}
return false;
}
but the problem is that for the same date before returns false and after returns true and i need them both to return false. My teacher told me there is a way to do it but i really don't know how and i spent tooooo much time on this. Is there a way?