> I am currently working on a program and wanted to know if anyone could help. I need to implement the increment method to

I am currently working on a program and wanted to know if anyone could help. I need to implement the increment method to

Posted at: 2014-12-18 
I think you need a "}" to end class Date before you begin class IncDate.

Note: My own personal opinion is that trivial getters (and setters) should be formatted as follows:

public int getYear () { return year; }

public int getMonth () { return month; }

public int getDay () { return day; }

public String toString () { return (month + "/" + day + "/" + year); }

I made a correction to your toString () expression.

This is the program...

package dates;

public class Date {

protected int year;

protected int month;

protected int day;



public Date(int newMonth, int newDay, int newYear)

{



month = newMonth;

day = newDay;

year = newYear;

}



public int getYear()

{



return year;

}



public int getMonth()

{



return month;

}



public int getDay()

{



return day;

}



public int lilian()

{

final int SUBDAYS = 578100;



int numDays = 0;



numDays = year * 365;

if (month <= 2)

numDays = numDays + (month - 1) * 31;

else

numDays = numDays + ((month - 1) * 31)

- ((4 * (month - 1) + 27) / 10);



numDays = numDays + day;



numDays = numDays + (year / 4) - (year / 100) + (year / 400);



if(month < 3)

{

if ((year % 4) == 0) numDays = numDays - 1;

if ((year % 100) == 0) numDays = numDays + 1;

if ((year % 400) == 0) numDays = numDays - 1;

}



numDays = numDays - SUBDAYS;



return numDays;

}



public String toString()

{



return(month + "/" + "/" + year);

}



public class IncDate extends Date

{



public IncDate(int newMonth, int newDay, int newYear)

{



super(newMonth, newDay, newYear);

}



public void increment()

{



}



}