Results 1 to 6 of 6
- 07-03-2008, 01:03 PM #1
Member
- Join Date
- Jun 2008
- Location
- Australia
- Posts
- 43
- Rep Power
- 0
Convert Currency to Words in English
The program will accept a double-data type input from a user. Function of the program is to convert the number inputted to its equivalent words.
eg.
12345.67 = Twelve thousand and three hundred and forty five dollars and sixty seven cents
765.43 = seven hundred and sixty five dollars and forty three cents
Oh. By the way, using the following methods on the java.lang.String is much appreciated.
* charAt()
* length()
* trim()
* valueOf() - overload
* toCharArray()
* indexOf(String str)
* indexOf(String str, int fromIndex)
Does anybody have the idea here?
- 07-03-2008, 01:53 PM #2
Hi,
Try with the following steps.
1. Get the double value and convert into string.
2. Check if that String say str has a "."
3. If str has a "." then crete 2 substrings of str say str1=765 and str2=43 by using indexOf(".") & susstring() methodsand if it does not have then u can leave it as it is.
4.Check the length of each string say 3 for 765.
5.Use string tokenizer or using a normal string methods get each digit.
6.then use concat() function of string with each digit and the value like dollars/cents depending on the the place of the digit.
Go ahead All the Best...To finish sooner, take your own time....
Nivedithaaaa
- 07-04-2008, 04:00 AM #3
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,374
- Blog Entries
- 1
- Rep Power
- 18
When concat the strings you have think about additional strings too, like 'thousand' 'hundred' and so on.
- 10-20-2008, 06:31 AM #4
Member
- Join Date
- Jun 2008
- Posts
- 15
- Rep Power
- 0
I have been looking for sites like this for a long time. Thank you!.txt
I have been looking for sites like this for a long time. Thank you!
- 10-20-2008, 11:16 AM #5
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,374
- Blog Entries
- 1
- Rep Power
- 18
- 03-29-2009, 07:25 AM #6
Member
- Join Date
- Mar 2009
- Posts
- 3
- Rep Power
- 0
Similar Threads
-
Be smart in English...
By Eranga in forum EntertainmentReplies: 22Last Post: 11-10-2009, 10:14 AM -
Java Program To Convert A Number In To Words With Decimals
By javanewbie in forum New To JavaReplies: 1Last Post: 07-02-2008, 01:58 PM -
Formatting a number to currency
By Java Tip in forum java.textReplies: 0Last Post: 04-16-2008, 10:59 PM -
Setting currency
By Java Tip in forum Java TipReplies: 0Last Post: 11-16-2007, 02:08 PM -
Menues in english and spanish languages
By aleplgr in forum AWT / SwingReplies: 0Last Post: 08-06-2007, 10:12 AM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks