Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Help!!!!

 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
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
 
author and iconoclast
Posts: 24207
46
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
One suggestion I have for you: please stop creating new threads to discuss this problem! If you kept the discussion in one thread, people would know what's already been said, and could build on other answers. As it stands, all I know is that you've brought this up several times already, and I don't know what you've tried or where your problems really lie.

Looking at your recent posts, though, I can only find this one. It appears that a few of your threads have been deleted. So let's go back to that other thread, in which Stan's replied once, and continue the conversation. Reply over there, say what you tried based on what Stan said, what happened, and where you are now.

So I'm closing this thread.
[ November 16, 2005: Message edited by: Ernest Friedman-Hill ]
 
Consider Paul's rocket mass heater.
    Bookmark Topic Watch Topic
  • New Topic