Project 2 - Phone Mnemonics

Due - Friday, October 13, 2006

The goal of this project is to give you experience using recursion. You will write a program that takes as input a seven-digit phone number and recursively generates all possible combinations of letters that represent that number. You can visit http://www.phonespell.org/ to get a sense for how your program will work.

The mapping from number to letter is based on the letters that appear on each key of a phone keypad. As an example, given the two-digit input 23, your program would generate the following output:

AD
AE
AF
BD
BE
BF
CD
CE
CF


Note that you will need to generate all possible combinations, not just the combinations that include English words. In addition, the numbers 1 and 0 do not map to letters. Therefore, you can simply print them as-is. The complete mapping is as follows:

1 = 1
2 = A,B,C
3 = D,E,F
4 = G,H,I
5 = J,K,L
6 = M,N,O
7 = P,Q,R.S
8 = T,U.V
9 = W,X,Y,Z

Due 9:40AM Friday October 13, 2006

  1. Complete and submit your working code. Turn in a hard copy in class and place a copy of your .java files in /home/submit/cs112/username.
  2. Make sure that each function is well documented. Your documentation should specify the type and function of the input parameters and output.
  3. Run your program on a variety of inputs ensuring that all error conditions are handled correctly.
Note: No portion of your code may be copied from any other source including another text book, a web page, or another student (current or former). You must provide citations for any sources you have used in designing and implementing your program.
Sami Rollins