class Date {
private int day;
private int month;
private int year;
public Date() {
}
public Date(int day, int month, int year) {
this.day = day;
this.month = month;
this.year = year;
}
public int getDay() {
return this.day;
}
public int getMonth() {
return this.month;
}
public int getYear() {
return this.year;
}
public void setDay(int day) {
day = enteredDay;
}
public void setMonth(int month) {
month = enteredMonth;
}
public void setYear(int year) {
year = enteredYear;
}
public String toString() {
return getDay() + "/" + getMonth() + "/" + getYear();
}
public boolean isEarlier(Date) {
if (enteredDay.getDay() < day) {
return true;
} else {
return false;
}
}
}
I'm having trouble getting the last method to work. It must be boolean and return true if a date is earlier than it. My problem (at least as far as I know) is figuring out what to write either side of the '<' operator. Any feedback on the rest of the code would be greatly appreciated.