-
Notifications
You must be signed in to change notification settings - Fork 25
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
base: main
Are you sure you want to change the base?
completed #5
Conversation
There was a problem hiding this 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!
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]); | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very cool input sanitization!
Map<String,String> removed = removedFromTally(ids); | ||
System.out.println("Here are the users who did not have their votes counted:"); | ||
System.out.println(removed); |
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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!
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; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very cool!
No description provided.