My code isn't running and I know I have brackets in the wrong places.
import java.util.Calendar; public class Date { private int month; private int day; private int year; public static void main(String[] args) { public Date( int theMonth, int theDay, int theYear ) { month = checkMonth( theMonth ); year = checkYear( theYear ); day = checkDay( theDay ); System.out.printf( "Date object constructor for date %s\n", toString() ); } private int checkYear( int testYear ) { if ( testYear > 0 ) return testYear; else { System.out.printf( "Invalid year (%d) set to 1.\n", testYear ); return 1; } } private int checkMonth( int testMonth ) { if ( testMonth > 0 && testMonth <= 12 ) return testMonth; else { System.out.printf( "Invalid month (%d) set to 1.\n", testMonth ); return 1; } } private int checkDay( int testDay ) { int daysPerMonth[] = { 0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }; if ( testDay > 0 && testDay <= daysPerMonth[ month ] ) return testDay; if ( month == 2 && testDay == 29 && ( year % 400 == 0 || ( year % 4 == 0 && year % 100 != 0 ) ) ) return testDay; System.out.printf( "Invalid day (%d) set to 1.\n", testDay ); return 1; } public void nextDay() { int testDay = day + 1; if ( checkDay( testDay ) == testDay ) day = testDay; else { day = 1; nextMonth(); } } public void nextMonth() { if ( 12 == month ) year++; month = month % 12 + 1; } public String toString() { return String.format( "%d/%d/%d", month, day, year ); } } } class DateTest { public static void main( String args[] ) { System.out.println( "Checking increment" ); Date testDate = new Date( 03, 13, 2011 ); for ( int counter = 0; counter < 3; counter++ ) { testDate.nextDay(); System.out.printf( "Incremented Date: %s\n", testDate.toString() ); } } }