Here is another way to do it.(recursive way(shorter) or you can do it without
recursive(long))
this is a recursive method
static i = 0;
public static void convert(int num)
{
if (num < 10)
{ switch num
{
case 1: System.out.print("one"); break;
case 2: .......................
........................case 9 :
}
switch i
{ case 1: System.out.print("tens"); break;
case 2: System.out.print("hundreds"); break;
................
}
else
{ i++
convert(num / 10);
switch (num%10) {
case 1: System.out.print("one"); break;
case 2: .......................
........................case 9 :
}
}
}
you can keep track of the position of the number to determine (thousand,
hundred....)
you can use double as parameter but you should treat it in slightly different
way
I hope you will help you.