Assignment #2: Maps

Many companies like to have phone numbers that can be spelled on the phone pad, rather than being random digits. For instance, 1-800-MATTRES is actually 1-800-628-8737. Also, numbers, such as panther IDs can sometimes be more easily remembered when they can be spelled out on a phone pad. For instance, the account number 7378378377, which is hard to remember would be easier to remember if one observes that the word "REQUESTERS" types the same sequence of buttons on a phone pad. This account number is special, because "PERVERTERS" also types the same sequence.

Write a program that finds the phone numbers that contain the MOST matching words, where the words will be contained in a dictionary that I will provide. If there are several such phone numbers, print each of them out, along with the words that they match. There are no restriction on the number of digits in a phone number.

Covers

java.util classes.

Strategy

For each word, compute its phone number. You will use a Map in which the key is a String that is a phone number, and the value is a List of all words that have the key as their phone number. After constructing the Map, you simply need to find the longest list, and since there may be ties, one way is to keep a list of Map.Entry objects that represent the current longest lists.

What To Submit

Submit complete source code and the list of phone numbers and words computed by your program.