HRSystem_5/src/Organization/Date.java
// utility method to confirm proper day value based on month and year
utility method to confirm proper day value based on month and year
utility method to confirm proper day value based on month and year
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.", testDay );
      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." , testDay ) ; return 1 ; }
utility method to confirm proper day value based on month and year
utility method to confirm proper day value based on month and year
// check if day in range for month // check for leap year // maintain object in consistent state