How do I convert the Integer to String by:

1. Asking the user to input the number (Eg: 704 = Seven Hundred and Four)

2. Display the output in JTextArea.

3. Using Arrays

Thanks for your support.

To do that you will essentially need a ton of logic. For example, 717 would print out seven hundred seventeen whereas 707 would print out seven hundred and seven. You would have a bunch of cases like this. You could begin by examining the similarities instead of the differences: For example, for any value, the first part will always be the same (i.e. both 523 and 512 start with 'five hundred').

But even in more complicated cases, such as
540,546
1,234,332

You'll notice it is still pronounced with the same rules. You should start by creating some arrays where depending on how many digits into the number you are, you can access the array and it will give the appropriate word (i.e. thousand, million, billion, etc).

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.