Skip to content

Commit f1839f5

Browse files
committed
Fix: Allows merge to be fixed for github
1 parent 4fcff3a commit f1839f5

File tree

4 files changed

+150
-53
lines changed

4 files changed

+150
-53
lines changed

.vscode/settings.json

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"java.compile.nullAnalysis.mode": "automatic",
3+
"java.configuration.updateBuildConfiguration": "interactive"
4+
}
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,98 @@
11
package com.codedifferently.projectoop.decode.decodelifeapp;
22

3+
34
import java.util.ArrayList;
4-
import java.util.Scanner;
5-
6-
public class EventCollection {
7-
Scanner input = new Scanner(System.in);
8-
ArrayList<String> events = new ArrayList<>();
9-
10-
public void addEvent(String event) {
11-
events.add("Conference");
12-
events.add("Job fair");
13-
events.add("Hackathon");
14-
events.add("Networking Social");
15-
events.add("Bootcamp Program Applications");
16-
events.add("Pitch Competitions");
17-
events.add("Internship Applications");
18-
events.add("Mentorship Programs");
19-
events.add("Webinars");
20-
events.add("Study Hall Session");
21-
events.add("Tech Talks");
22-
}
23-
24-
public void removeEvent(String event) {
25-
events.remove(event);
26-
}
27-
28-
public void displayEvents() {
29-
System.out.println("Upcoming Tech Events:");
30-
for (int i = 0; i < events.size(); ++i) {
31-
System.out.println((i + 1) + ". " + events.get(i));
32-
}
33-
}
34-
35-
//Method that will allow users that login with the role of mentor to add events
36-
//This should go inside of the events folder.
37-
38-
39-
}
5+
import java.util.HashMap;
6+
import java.util.Map;
7+
8+
9+
public class EventCollection extends Object {
10+
public ArrayList<String> eventNames = new ArrayList<>();
11+
public ArrayList<String> eventDates = new ArrayList<>();
12+
public ArrayList<String> eventLocations = new ArrayList<>();
13+
public ArrayList<String> eventDescriptions = new ArrayList<>();
14+
15+
16+
private Map<String, String> eventDescriptionMap;
17+
18+
19+
public EventCollection() {
20+
eventDescriptionMap = new HashMap<>();
21+
initializeEventDescriptions();
22+
}
23+
24+
25+
// Initialize event names and their corresponding descriptions
26+
private void initializeEventDescriptions() {
27+
eventDescriptionMap.put("Conference", "Network with industry leaders and fellow tech enthusiasts.");
28+
eventDescriptionMap.put("Job fair", "Bring your resume and meet potential employers.");
29+
eventDescriptionMap.put("Hackathon", "Collaborate in real-time to build awesome projects.");
30+
eventDescriptionMap.put("Networking Social", "Get insights from tech veterans and grow your skills.");
31+
eventDescriptionMap.put("Bootcamp Program Applications", "Learn how to pitch your ideas to real investors.");
32+
eventDescriptionMap.put("Pitch Competitions", "Hands-on experience with the latest technologies.");
33+
eventDescriptionMap.put("Internship Applications", "Live Q&A with developers from top tech companies.");
34+
eventDescriptionMap.put("Mentorship Programs", "Apply your skills in real-world scenarios.");
35+
eventDescriptionMap.put("Webinars", "Build connections that will last beyond the event.");
36+
eventDescriptionMap.put("Study Hall Session", "Discover new tools and frameworks from experts.");
37+
eventDescriptionMap.put("Tech Talks", "Explore industry trends and deepen your technical expertise.");
38+
}
39+
40+
41+
public void addDefaultEvents() {
42+
addEvent("Conference", "2025-07-15", "Tech Center");
43+
addEvent("Job fair", "2025-08-01", "Downtown Hub");
44+
addEvent("Hackathon", "2025-06-20", "Innovation Lab");
45+
addEvent("Networking Social", "2025-09-05", "Skyline Lounge");
46+
addEvent("Bootcamp Program Applications", "2025-05-10", "Online");
47+
addEvent("Pitch Competitions", "2025-07-22", "Venture Hall");
48+
addEvent("Internship Applications", "2025-04-30", "Online Portal");
49+
addEvent("Mentorship Programs", "2025-06-01", "Community Center");
50+
addEvent("Webinars", "2025-05-20", "Virtual");
51+
addEvent("Study Hall Session", "2025-04-25", "Library Room B");
52+
addEvent("Tech Talks", "2025-07-12", "Tech Auditorium");
53+
}
54+
55+
56+
public void addEvent(String name, String date, String location) {
57+
eventNames.add(name);
58+
eventDates.add(date);
59+
eventLocations.add(location);
60+
eventDescriptions.add(generateDescriptionForEvent(name));
61+
}
62+
63+
64+
public void removeEvent(String name) {
65+
int index = eventNames.indexOf(name);
66+
if (index != -1) {
67+
eventNames.remove(index);
68+
eventDates.remove(index);
69+
eventLocations.remove(index);
70+
eventDescriptions.remove(index);
71+
}
72+
}
73+
74+
75+
public void displayEvents() {
76+
System.out.println("📅 Upcoming Tech Events:");
77+
for (int i = 0; i < eventNames.size(); i++) {
78+
System.out.println((i + 1) + ". " + eventNames.get(i));
79+
System.out.println(" Date: " + eventDates.get(i));
80+
System.out.println(" Location: " + eventLocations.get(i));
81+
System.out.println(" Description: " + eventDescriptions.get(i));
82+
System.out.println();
83+
}
84+
}
85+
private String generateDescriptionForEvent(String name) {
86+
return eventDescriptionMap.getOrDefault(name, "No description available.");
87+
}
88+
89+
90+
// Getters for testing
91+
public ArrayList<String> getEventNames() { return eventNames; }
92+
public ArrayList<String> getEventDates() { return eventDates; }
93+
public ArrayList<String> getEventLocations() { return eventLocations; }
94+
public ArrayList<String> getEventDescriptions() { return eventDescriptions; }
95+
}
96+
97+
98+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
package com.codedifferently.projectoop.decode.decodelifeapp;
2+
3+
4+
import static org.junit.jupiter.api.Assertions.assertEquals;
5+
import static org.junit.jupiter.api.Assertions.assertNotNull;
6+
import org.junit.jupiter.api.Test;
7+
8+
9+
10+
11+
class EventCollectionTest {
12+
13+
14+
@Test
15+
void testAddEvent(){
16+
EventCollection eventCollection = new EventCollection();
17+
18+
19+
eventCollection.addEvent("Conference", "2025-07-15", "Tech Center");
20+
21+
22+
assertEquals(1, eventCollection.eventNames.size());
23+
assertEquals("Conference", eventCollection.eventNames.get(0));
24+
assertEquals("2025-07-15", eventCollection.eventDates.get(0));
25+
assertEquals("Tech Center", eventCollection.eventLocations.get(0));
26+
assertNotNull(eventCollection.eventDescriptions.get(0)); // Description should be generated
27+
}
28+
29+
30+
@Test
31+
void testAddDefaultEvents() {
32+
EventCollection eventCollection = new EventCollection();
33+
eventCollection.addDefaultEvents();
34+
35+
36+
// Check that all 11 events were added
37+
assertEquals(11, eventCollection.eventNames.size());
38+
assertEquals(11, eventCollection.eventDates.size());
39+
assertEquals(11, eventCollection.eventLocations.size());
40+
assertEquals(11, eventCollection.eventDescriptions.size());
41+
42+
43+
// Spot-check one event
44+
assertEquals("Hackathon", eventCollection.eventNames.get(2));
45+
assertEquals("2025-06-20", eventCollection.eventDates.get(2));
46+
assertEquals("Innovation Lab", eventCollection.eventLocations.get(2));
47+
}
48+
}
49+
50+
51+

decode/app/src/test/java/decode/AppTest.java

-17
This file was deleted.

0 commit comments

Comments
 (0)