Here is my code: (it compiles fine and runs but i need to know if i am doing the assignment correctly. thanks)
public class Date
{
private int day;
private int month;
private int year;
public Date()
{
day = 0;
month =0;
year = 0;
}
public Date(int day, int month, int year)
{
this.day = day;
this.month = month;
this.year = year;
}
public int getMonth()
{
return month;
}
public int getDay()
{
return day;
}
public int getYear()
{
return year;
}
public void setMonth(int month)
{
this.month = month;
}
public void setDay(int day)
{
this.day = day;
}
public void setYear(int year)
{
this.year = year;
}
public String toString()
{
String report;
report = "+ month / + day / + year";
//report = report + "+ day";
//report = report + "+ year";
return report;
}
public boolean equals(Date anotherDate)
{
boolean isEqual;
isEqual = ((day == anotherDate.getDay()) &&
(month == anotherDate.getMonth()) &&
(year == anotherDate.getYear()));
return isEqual;
}
}