Assignemnt #95 Month Offset
Code
///Name: Morgan Kaplan
///Period: 5
///Project Name: Month Offset
///File Name: MonthOffset.java
public class MonthOffset
{
public static String MonthOffset( int Month )
{
String 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 Output