-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMonthOffSet.java
More file actions
105 lines (98 loc) · 3.05 KB
/
Copy pathMonthOffSet.java
File metadata and controls
105 lines (98 loc) · 3.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package assignment_10528808;
/**
*
* @author Mawutor
*/
public class MonthOffSet
{
public static int month_offset( int month )
{
int result;
if(month==1)
{
result =1;
return result;
}
else if(month==2)
{
result =4;
return result;
}
else if(month==3)
{
result =4;
return result;
}
else if(month==4)
{
result =0;
return result;
}
else if(month==5)
{
result =2;
return result;
}
else if(month==6)
{
result =5;
return result;
}
else if(month==7)
{
result =2;
return result;
}
else if(month==8)
{
result =3;
return result;
}
else if(month==9)
{
result =6;
return result;
}
else if(month==10)
{
result=1;
return result;
}
else if(month==11)
{
result =4;
return result;
}
else if(month==12)
{
result =6;
return result;
}
else
{
result =-1;
return result;
}
}
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) );
}
}