I'm developing a simple Point of Sale application. In the invoice I need to show the amount in words. I don't have any clues how to do it. Is there any ready-made application, which i can use! or else any tips?
If possible, spell out exactly what it is you are looking for and be as specific as possible. What do you mean by "amount in words"? Do you want a method that takes a double as a parameter and returns a String of the number in english words? Something like this?
Or am I way off base? If this is what you are looking for, ask any of the students in the cattle drive who have completed assignment Java-4b (Say). They will have a ready-made routine that they'd love to share w/ you.
If they "get" the ranch, they won't share. They might give some good hints, though.
Doubles are dangerous for money amounts because they don't hold exactly the values you expect. They will give you a nasty surprise sooner or later. It's safer to use a integer type (int or long) and store the amount * 100. If you're stuck with double - working with code an instructor gave you for example - we can still try to get by.
Let's see how much you are comforatable with so far. If you have a number like 12345 (for $123.45) ... how do you get the cents? The dollars?
A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi