The moose likes Java in General and the fly likes Converting Number to Word Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Converting Number to Word" Watch "Converting Number to Word" New topic

Converting Number to Word

Ankita Jha
Ranch Hand

Joined: Sep 15, 2008
Posts: 55
Hello ranchers,

In my application i a need which will convert number to Word.
Problem is ,When i have whole number like (10000 or 2260) etc,it works properly.
Byt i have some number like 158.32 then it shld be read as "One hunderd fifty eight and thirty two paise" but it read the number as "Fifteen thousand eight hundred and thirty two"

Im pasting my code below.Any help wil be appreciated.Thanks in advance.
Swastik Dey

Joined: Jan 08, 2009
Posts: 1449

One problem in your code what I could notice is in

I have not went through your entire code but probably calling the convertNumber function twice might solve your requirement

Ankita Jha
Ranch Hand

Joined: Sep 15, 2008
Posts: 55
Thanks Swastik Dey
Got it working
salvin francis
Ranch Hand

Joined: Jan 12, 2009
Posts: 917

program can be made much more simpler:


so units[4] would return "Four", I dont see why you require so many switch cases etc.

My Website: [Salvin.in] Cool your mind:[Salvin.in/painting] My Sally:[Salvin.in/sally]
I agree. Here's the link: http://aspose.com/file-tools
subject: Converting Number to Word
Similar Threads
Program to print numbers from 0 to 100 in words
mod using double
Just curious how ugly this is?
how to convert currency figures
convertNumber and rounding mode