I have been asked to create a
Java Program where I have to prompt the user for a number entry and this should display a
word. For example the user would enter 223 and this would display the word Bad.
Meaning 2 would hold a b c, 3 would hold def 4 would hold ghi 5 would hold jkl 6 would hold mno 7 would hold pqrs 8 would hold tuv and 9 would hold wxyz.
If I enter 223 it would loop round the dictionary, until it will find that word bad.
The words in the dictionary must be converted to these number, but they must not be hard coded.
To store the dictionary I will use Array. The data type will be
string. BufferReader will be used to read in the text file.
To use the number key I will use string buffer
example
StringBuffer key = new StringBuffer();
for (int i = 0; i <word.length(); i++)
{
switch (word.charAt(i))
case 'a':
case 'b':
case 'c':
key.append('2'); break;
But I have no idea how to convert the dictionary word into the numbers. Please Suggest ideas