This week's book giveaway is in the Security forum.
We're giving away four copies of Securing DevOps and have Julien Vehent on-line!
See this thread for details.
Win a copy of Securing DevOps this week in the Security forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Converting Number to Word  RSS feed

 
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
>
 
Rancher
Posts: 1830
15
Android Eclipse IDE Java Java ME
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 55
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Swastik Dey
Got it working
 
Saloon Keeper
Posts: 1754
44
Eclipse IDE Google Web Toolkit Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
program can be made much more simpler:

eg:


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

 
If you're gonna buy things, buy this thing and I get a fat kickback:
Thread Boost - a very different sort of advertising
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!