Skip to content

Feat/event collection #15

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,6 +1,101 @@
package com.codedifferently.projectoop.decode.decodelifeapp;


import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;


public class EventCollection extends Object {
public ArrayList<String> eventNames = new ArrayList<>();
public ArrayList<String> eventDates = new ArrayList<>();
public ArrayList<String> eventLocations = new ArrayList<>();
public ArrayList<String> eventDescriptions = new ArrayList<>();


private Map<String, String> eventDescriptionMap;

// Contrustor
public EventCollection() {
eventDescriptionMap = new HashMap<>();
initializeEventDescriptions();
}


// Initialize event names and their corresponding descriptions
private void initializeEventDescriptions() {
eventDescriptionMap.put("Conference", "Network with industry leaders and fellow tech enthusiasts.");
eventDescriptionMap.put("Job fair", "Bring your resume and meet potential employers.");
eventDescriptionMap.put("Hackathon", "Collaborate in real-time to build awesome projects.");
eventDescriptionMap.put("Networking Social", "Get insights from tech veterans and grow your skills.");
eventDescriptionMap.put("Bootcamp Program Applications", "Learn how to pitch your ideas to real investors.");
eventDescriptionMap.put("Pitch Competitions", "Hands-on experience with the latest technologies.");
eventDescriptionMap.put("Internship Applications", "Live Q&A with developers from top tech companies.");
eventDescriptionMap.put("Mentorship Programs", "Apply your skills in real-world scenarios.");
eventDescriptionMap.put("Webinars", "Build connections that will last beyond the event.");
eventDescriptionMap.put("Study Hall Session", "Discover new tools and frameworks from experts.");
eventDescriptionMap.put("Tech Talks", "Explore industry trends and deepen your technical expertise.");
}


public void addDefaultEvents(String name, String date, String location) {
addEvent("Conference", "2025-07-15", "Tech Center");
addEvent("Job fair", "2025-08-01", "Downtown Hub");
addEvent("Hackathon", "2025-06-20", "Innovation Lab");
addEvent("Networking Social", "2025-09-05", "Skyline Lounge");
addEvent("Bootcamp Program Applications", "2025-05-10", "Online");
addEvent("Pitch Competitions", "2025-07-22", "Venture Hall");
addEvent("Internship Applications", "2025-04-30", "Online Portal");
addEvent("Mentorship Programs", "2025-06-01", "Community Center");
addEvent("Webinars", "2025-05-20", "Virtual");
addEvent("Study Hall Session", "2025-04-25", "Library Room B");
addEvent("Tech Talks", "2025-07-12", "Tech Auditorium");
}


public void addEvent(String name, String date, String location) {
eventNames.add(name);
eventDates.add(date);
eventLocations.add(location);
eventDescriptions.add(generateDescriptionForEvent(name));
}


public void removeEvent(String name) {
int index = eventNames.indexOf(name);
if (index != -1) {
eventNames.remove(index);
eventDates.remove(index);
eventLocations.remove(index);
eventDescriptions.remove(index);
}


}


public void displayEvents() {
System.out.println("📅 Upcoming Tech Events:");
for (int i = 0; i < eventNames.size(); i++) {
System.out.println((i + 1) + ". " + eventNames.get(i));
System.out.println(" Date: " + eventDates.get(i));
System.out.println(" Location: " + eventLocations.get(i));
System.out.println(" Description: " + eventDescriptions.get(i));
System.out.println();
}
}
private String generateDescriptionForEvent(String name) {
return eventDescriptionMap.getOrDefault(name, "No description available.");
}


// Getters for testing
public ArrayList<String> getEventNames() { return eventNames; }
public ArrayList<String> getEventDates() { return eventDates; }
public ArrayList<String> getEventLocations() { return eventLocations; }
public ArrayList<String> getEventDescriptions() { return eventDescriptions; }
}

import java.util.Scanner;

import com.codedifferently.projectoop.decode.decodelifeapp.exceptions.EmptyEventListException;
Expand Down Expand Up @@ -41,4 +136,4 @@ public void displayEvents() {
//This should go inside of the events folder.


}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
package com.codedifferently.projectoop.decode.decodelifeapp;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import org.junit.jupiter.api.Test;

class EventCollectionTest {


@Test
void testAddEvent(){
EventCollection eventCollection = new EventCollection();


eventCollection.addEvent("Conference", "2025-07-15", "Tech Center");


assertEquals(1, eventCollection.eventNames.size());
assertEquals("Conference", eventCollection.eventNames.get(0));
assertEquals("2025-07-15", eventCollection.eventDates.get(0));
assertEquals("Tech Center", eventCollection.eventLocations.get(0));
assertNotNull(eventCollection.eventDescriptions.get(0)); // Description should be generated
}


@Test
void testAddDefaultEvents() {
EventCollection eventCollection = new EventCollection();
eventCollection.addDefaultEvents();


// Check that all 11 events were added
assertEquals(11, eventCollection.eventNames.size());
assertEquals(11, eventCollection.eventDates.size());
assertEquals(11, eventCollection.eventLocations.size());
assertEquals(11, eventCollection.eventDescriptions.size());


// Spot-check one event
assertEquals("Hackathon", eventCollection.eventNames.get(2));
assertEquals("2025-06-20", eventCollection.eventDates.get(2));
assertEquals("Innovation Lab", eventCollection.eventLocations.get(2));
}
}