Assignment #95: Month Offset

Code

public class MonthOffset
{
	public static int monthOffset( int month )
	{
		int result = 0;
        
		if (month == 1) {
      
         result = 1;
         
      }
      
      if (month == 2) {
      
         result = 4;
         
      }
      
      if (month == 3) {
      
         result = 4;
         
      }
      
      if (month == 4) {
      
         result = 0;
         
      }
      
      if (month == 5) {
      
         result = 2;
         
      }
      
      if (month == 6) {
      
         result = 5;
         
      }
      
      if (month == 7) {
      
         result = 0;
         
      }
      
      if (month == 8) {
      
         result = 3;
         
      }
      
      if (month == 9) {
      
         result = 6;
         
      }
      
      if (month == 10) {
      
         result = 1;
         
      }
      
      if (month == 11) {
      
         result = 4;
         
      }
      
      if (month == 12) {
      
         result = 6;
         
      }
      
      else if (month > 12) {
      
         result = -1;
         
      }
		
		return result;
	}


	public static void main( String[] args )
	{
		System.out.println( "Offset for month 1: " + monthOffset(1) );
		System.out.println( "Offset for month 2: " + monthOffset(2) );
		System.out.println( "Offset for month 3: " + monthOffset(3) );
		System.out.println( "Offset for month 4: " + monthOffset(4) );
		System.out.println( "Offset for month 5: " + monthOffset(5) );
		System.out.println( "Offset for month 6: " + monthOffset(6) );
		System.out.println( "Offset for month 7: " + monthOffset(7) );
		System.out.println( "Offset for month 8: " + monthOffset(8) );
		System.out.println( "Offset for month 9: " + monthOffset(9) );
		System.out.println( "Offset for month 10: " + monthOffset(10) );
		System.out.println( "Offset for month 11: " + monthOffset(11) );
		System.out.println( "Offset for month 12: " + monthOffset(12) );
		System.out.println( "Offset for month 43: " + monthOffset(43) );
	}

}

    

Picture of the output