Assignment #95 Month Offset
Code
/// Name: Koosha Kimelman
/// Period: 7
/// Program Name: Month Offset
/// File Name: MonthOffset.java
/// Date Completed: 3/4/16
public class MonthOffset {
public static void main(String[] args) {
System.out.println("Offset for month 1: " + month_offset(1));
System.out.println("Offset for month 2: " + month_offset(2));
System.out.println("Offset for month 3: " + month_offset(3));
System.out.println("Offset for month 4: " + month_offset(4));
System.out.println("Offset for month 5: " + month_offset(5));
System.out.println("Offset for month 6: " + month_offset(6));
System.out.println("Offset for month 7: " + month_offset(7));
System.out.println("Offset for month 8: " + month_offset(8));
System.out.println("Offset for month 9: " + month_offset(9));
System.out.println("Offset for month 10: " + month_offset(10));
System.out.println("Offset for month 11: " + month_offset(11));
System.out.println("Offset for month 12: " + month_offset(12));
System.out.println("Offset for month 43: " + month_offset(43));
}
public static String month_offset(int n) {
String monthOffset;
if (n == 1)
monthOffset = "1";
else if (n == 2)
monthOffset = "4";
else if (n == 3)
monthOffset = "4";
else if (n == 4)
monthOffset = "0";
else if (n == 5)
monthOffset = "2";
else if (n == 6)
monthOffset = "5";
else if (n == 7)
monthOffset = "0";
else if (n == 8)
monthOffset = "3";
else if (n == 9)
monthOffset = "6";
else if (n == 10)
monthOffset = "1";
else if (n == 11)
monthOffset = "4";
else if (n == 12)
monthOffset = "6";
else
monthOffset = "-1";
return monthOffset;
}
}
Picture of the output