logo Practice-It logo

graders

Language/Type: Java Guava RangeMap Multiset collections
Author: Marty Stepp (on 2013/01/22)

Write a method named graders that helps the TAs figure out how many students' programs each one needs to grade. The method accepts two parameters: a Set of students' names to grade (strings), and a RangeMap where each key is a range of the alphabet (strings) and each value is the TA's name (string) who grades that range of the alphabet. Your method should return a Multiset of counts of how many students must be graded by each TA. For example, if the range map and set of students are the following:

  • set: [Joe, Stan, Ed, Paul, Dan, Bill, Tina, Lou, Qbert, Rob, Hank, Zaza, Karl, Mike]
  • range map: {[Aa..Ez]=Conor, [Fa..Jz]=April, [Ka..Nz]=Staci, [Oa-Sz]=Dana, [Ta-Zz]=Jake}

Then you would return the multiset [April x 2, Conor x 3, Staci x 3, Dana x 4, Jake x 2]. You may assume that every name maps to an alphabetic range that is covered by one of the TAs.

Type your solution here:


This is a method problem. Write a Java method as described. Do not write a complete program or class; just the method(s) above.

You must log in before you can solve this problem.


Log In

If you do not understand how to solve a problem or why your solution doesn't work, please contact your TA or instructor.
If something seems wrong with the site (errors, slow performance, incorrect problems/tests, etc.), please

Is there a problem? Contact a site administrator.