Java Forums

Main Menu
Home
Today's Posts
FAQ
Search
Contact Us

Java Network
Linux Archive
Java Tips
Java Tips Blog

Sponsored Links





Welcome to the Java Forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community, you will:

  • have access to post topics
  • communicate privately with other members (PM)
  • not see advertisements between posts
  • have the possibility to earn one of our surprises if you are an active member
  • access many other special features that will be introduced later.

Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 07-03-2008, 03:03 PM
Member
 
Join Date: Jun 2008
Location: Australia
Posts: 24
javanewbie is on a distinguished road
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?
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 07-03-2008, 03:53 PM
Niveditha's Avatar
Senior Member
 
Join Date: May 2008
Posts: 299
Niveditha is on a distinguished road
Send a message via Skype™ to Niveditha
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
Bookmark Post in Technorati
Reply With Quote
  #3 (permalink)  
Old 07-04-2008, 06:00 AM
Eranga's Avatar
Moderator
 
Join Date: Jul 2007
Location: Colombo, Sri Lanka
Posts: 4,402
Eranga has a spectacular aura aboutEranga has a spectacular aura about
Send a message via Yahoo to Eranga
When concat the strings you have think about additional strings too, like 'thousand' 'hundred' and so on.
__________________
Use an appropriate Subject. "Help, urgent!" isn't one.
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

Has someone helped you? Then you can
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
their helpful post.

Want to make your IDE the best?
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
Bookmark Post in Technorati
Reply With Quote
  #4 (permalink)  
Old 10-20-2008, 08:31 AM
Member
 
Join Date: Jun 2008
Posts: 15
kicksfanscom is on a distinguished road
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!
Bookmark Post in Technorati
Reply With Quote
  #5 (permalink)  
Old 10-20-2008, 01:16 PM
Eranga's Avatar
Moderator
 
Join Date: Jul 2007
Location: Colombo, Sri Lanka
Posts: 4,402
Eranga has a spectacular aura aboutEranga has a spectacular aura about
Send a message via Yahoo to Eranga
Quote:
Originally Posted by kicksfanscom View Post
I have been looking for sites like this for a long time. Thank you!
Are you talking about our community? Nice to here your comments.
__________________
Use an appropriate Subject. "Help, urgent!" isn't one.
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

Has someone helped you? Then you can
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
their helpful post.

Want to make your IDE the best?
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Be smart in English... Eranga Jokes and Funny Things 17 11-17-2008 11:23 AM
Java Program To Convert A Number In To Words With Decimals javanewbie New To Java 1 07-02-2008 03:58 PM
Formatting a number to currency Java Tip java.text 0 04-17-2008 12:59 AM
Setting currency Java Tip Java Tips 0 11-16-2007 04:08 PM
Menues in english and spanish languages aleplgr AWT / Swing 0 08-06-2007 12:12 PM


All times are GMT +3. The time now is 01:10 AM.


VBulletin, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org