-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEventManagement.java
More file actions
58 lines (49 loc) · 1.76 KB
/
Copy pathEventManagement.java
File metadata and controls
58 lines (49 loc) · 1.76 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
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
public class EventManagement {
private boolean isEventActive;
private Map<Integer, Event> events = new HashMap<>();
// Constructor
public EventManagement(boolean isEvent) {
this.isEventActive = isEvent;
}
// Getter
public boolean getIsEvent() {
return isEventActive;
}
// Setter
public void setIsEvent(boolean isEvent) {
this.isEventActive = isEvent;
}
// Method to schedule an event
public void scheduleEvent(int eventId, Date eventDate, String parkingZone) {
if (!events.containsKey(eventId)) {
events.put(eventId, new Event(eventId, eventDate, parkingZone));
System.out.println("Event scheduled for: " + eventDate.toString() + " at " + parkingZone);
} else {
System.out.println("Event already scheduled with this ID.");
}
}
// Method to cancel an event
public void cancelEvent(int eventId) {
if (events.containsKey(eventId)) {
events.remove(eventId);
System.out.println("Event with ID " + eventId + " has been canceled.");
} else {
System.out.println("No event found with ID " + eventId);
}
}
// Nested class to represent an Event
private class Event {
private int eventId;
private Date eventDate;
private String parkingZone;
Event(int eventId, Date eventDate, String parkingZone) {
this.eventId = eventId;
this.eventDate = eventDate;
this.parkingZone = parkingZone;
}
// Additional methods can be implemented here to interact with parking management
}
}