Skip to content

completed#5

Open
mlarsen-source wants to merge 6 commits intogrc-cohort-21:mainfrom
mlarsen-source:main
Open

completed#5
mlarsen-source wants to merge 6 commits intogrc-cohort-21:mainfrom
mlarsen-source:main

Conversation

@mlarsen-source
Copy link
Copy Markdown

No description provided.

Copy link
Copy Markdown

@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 thread src/Tallyer.java
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]);
}

Copy link
Copy Markdown

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 thread src/Tallyer.java
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);
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Nice extra info!

Comment thread src/Tallyer.java
{
// WAVE 2
// TODO: Implement this method
Map<String, Integer> idCount = tallyTopics(ids);
Copy link
Copy Markdown

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 thread src/Tallyer.java
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;
}
Copy link
Copy Markdown

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