# converting digits into numbers

Let us say i deposited money of 1000 Dollards then i the deposited amount should be
printed out like 'one thousand dollars'. if deposit  29932 million it should print
twentynine thousand nine hundreden thirty two.is there any way i can achieve this
thru java programming???
###### Who is Participating?

Commented:
Yes.  If it is an int then use a switch case structure. If it is a string then change it to an int. Better yet if it is a string recursively break it down into sub parts, goto another method with each sub-part where the switch is and then store the wording for print-out.  Break it down from right-to-left, the tens and hundreds you have to be careful about, but the others (thousands and millions, ect) you can reuse a case.
talk through:
29932
first pass = in 2 out two  :count = 1
second pass = in 3 out thirty  :count =2
third pass = in 9 out nine hundred  :count =3
fourth pass= in 9 out nine thousand  :count =4
fifth pass= in 2 out twenty  :count =5

use a counter to 'remember' where you are.  Sorry about not giving code, but this question looks suspiciously like homework.

Tom
0

Commented:
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:

- Points for tomboshell

Venabili
EE Cleanup Volunteer
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.