- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathevents.java
More file actions
Latest commit
79 lines (64 loc) · 1.67 KB
/
Copy pathevents.java
File metadata and controls
79 lines (64 loc) · 1.67 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
importjava.util.Objects;
importjava.util.LinkedList;
importjava.util.List;
importjava.util.Collections;
importjava.text.SimpleDateFormat;
importjava.util.Date;
importjava.text.ParseException;
importjava.util.*;
//import java.util.Calender;
publicclassMain
{
publicstaticvoidmain(String []artgs)
{
List<Event> eventliste = newLinkedList<>();
eventliste.add(newEvent("Halloween", "22/11/2020"));
eventliste.add(newEvent("birthday", "9/9/2020"));
eventliste.add(newEvent("silverster", "1/2/2020"));
eventliste.add(newEvent("christmas", "5/1/2020"));
eventliste.add(newEvent("birthday", "12/10/2020"));
Event.checkWinter(eventliste);
}
}
classEvent
{
StringEventName;
StringEventDatum;
Event(StringEventName, StringEventDatum)
{
this.EventName = Objects.requireNonNull(EventName,"EventName can not be Null");
this.EventDatum = Objects.requireNonNull(EventDatum, "EventDatum can not be Null");
}
publicStringgetEventName()
{
returnEventName;
}
publicStringgetEventDatum()
{
returnEventDatum;
}
publicstaticvoidcheckWinter(List<Event> eventliste)
{
for (Eventevent : eventliste)
{
//System.out.println("event: " + event.getEventDatum());
Datea = null;
try
{
a = newSimpleDateFormat("dd/MM/yyyy").parse(event.getEventDatum());
}
catch (ParseExceptione)
{
System.err.println("leck eier");
}
Calendarcalendar = Calendar.getInstance();
calendar.setTime(a);
intcurrentMONTH = calendar.get(Calendar.MONTH)+1;
intwinterTIME = 8;
if (currentMONTH > winterTIME)
{
System.out.println(event.getEventName() + " is in the winter");
}
}
}
}