Skip to content
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

completed #5

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open

Conversation

mlarsen-source
Copy link

No description provided.

Copy link

@auberonedu auberonedu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great job! Very cool extra functionality you added!

Comment on lines +30 to +46
while (input.hasNextLine())
{
// skip empty lines in file
String line = input.nextLine();
if(line.isEmpty())
{
continue;
}

// only add ID and topic to applicable lists if the line contains both items
String[] lineArray = line.split(" ");
if (lineArray.length == 2)
{
ids.add(lineArray[0]);
topics.add(lineArray[1]);
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very cool input sanitization!

Comment on lines +63 to +65
Map<String,String> removed = removedFromTally(ids);
System.out.println("Here are the users who did not have their votes counted:");
System.out.println(removed);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice extra info!

// WAVE 2
// TODO: Implement this method
Map<String, Integer> idCount = tallyTopics(ids);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Smart re-use of the other method!

Comment on lines +140 to +159
public static Map<String, String> removedFromTally(List<String> ids)
{


return null;
}
Map<String, Integer> idCount = tallyTopics(ids);
Map<String, String> removed = new TreeMap<>();

for (Map.Entry<String, Integer> entry : idCount.entrySet())
{
String id = entry.getKey();
int count = entry.getValue();

if (count < 2) {
removed.put(id, "Not Enough Votes");
} else if (count > 2) {
removed.put(id, "Too Many Votes");
}
}
return removed;
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very cool!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants