Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
i want to write a simple algorithm in java.. but i'm still not getting the idea how to do it.. i want to write a program that can convert a number into word form i.e Input: 123 Output: One Hundread and twenty three, can anyone help me to find a solution for this problem.. thnx

Hmmm, sounds like homework to me.
You'll find that few people here will help you unless you make an attempt first.
http://www.computing.net/programming/wwwboard/forum/7407.html

let me see..........
i will provide you with some pseudocode. the rest is yours!
create an array with numbers from 1-9.
create another array with the the alphabetic form
example. "one", "two", "three" make sure they are in order. try subscripts if you are adventurous.
then when you enter the numbers use them as reference in the array.
i hope you are creating a normal program not a GUI.good luck - saddam.

From the famous words of eaw8806...
REMEMBER 7407!!!Please have a look at the thread below:
Date: August 06, 2003 at 10:20:46 Pacific
Subject: Have a homework question???
http://www.computing.net/programming/wwwboard/forum/7407.html
(Thanks for posting the reminder of this thread Dr. Nick)
At any rate, the simple solution would be to have a character array with an integer index used as a cross reference...string myArray[10000];
myArray[1] = "one";
...
myArray[100] = "One Hundred";
...
myArray[241] = "Two Hundred Fourty One";
...Try it.
IR

![]() |
![]() |
![]() |

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |