Assignemnt #95 and Month Offset
Code
/// Name: Raff Lisbona
/// Period: 6
/// Program Name: Month Offset
/// File Name: MonthOffset.java
/// Date Finished: 2/24/2016
public class MonthOffset
{
public static int monthOffset( int month )
{
int result;
if ( month == 1 )
result = 1;
else if ( month == 2 )
result = 4;
else if ( month == 3 )
result = 4;
else if ( month == 4 )
result = 0;
else if ( month == 5 )
result = 2;
else if ( month == 6 )
result = 5;
else if ( month == 7 )
result = 0;
else if ( month == 8 )
result = 3;
else if ( month == 9 )
result = 6;
else if ( month == 10 )
result = 1;
else if ( month == 11 )
result = 4;
else if ( month == 12 )
result = 6;
else
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