Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

equivalent of number in words in java

Status
Not open for further replies.

samasamajam

Programmer
Dec 27, 2002
13
0
0
GB
hi

in my application, i have to print cheques in which, i have to represent amount in words(for UK currency) it would be of great help if some code is readily available, in java.

i would really appreciate the help.

thanks in advance
 
I don't have the code but I think I should do this way :
Let's take the exmaple of "12427956"
1) cut your number in groups of 3 digits : each group will be associated with a "multiplier" (leftest group may contains less tha 3 digits) :
- 1st group from right (956): no multiplier
- 2nd group from right (427): thousands
- 3nd group from right (12): millions
- ....

2) Threat each group separatly the same way going from the leftest group to the rightest this way :
- take the first digit (if present), write it's literal value (here : nothing).
- take the 2 last digits (if present), write their literal value (here : "twelve").
- write the multiplier (here "millions")

Hope that it'll help.

Water is not bad as long as it stays out human body ;-)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top