?
Solved

converting digits into numbers

Posted on 2001-09-06
3
Medium Priority
?
424 Views
Last Modified: 2012-05-04
Let us say i deposited money of 1000 Dollards then i the deposited amount should be
printed out like 'one thousand dollars'. if deposit  29932 million it should print
twentynine thousand nine hundreden thirty two.is there any way i can achieve this
thru java programming???
0
Comment
Question by:gauty
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 7

Accepted Solution

by:
tomboshell earned 120 total points
ID: 6460278
Yes.  If it is an int then use a switch case structure. If it is a string then change it to an int. Better yet if it is a string recursively break it down into sub parts, goto another method with each sub-part where the switch is and then store the wording for print-out.  Break it down from right-to-left, the tens and hundreds you have to be careful about, but the others (thousands and millions, ect) you can reuse a case.  
talk through:
29932
first pass = in 2 out two  :count = 1
second pass = in 3 out thirty  :count =2
third pass = in 9 out nine hundred  :count =3
fourth pass= in 9 out nine thousand  :count =4
fifth pass= in 2 out twenty  :count =5

use a counter to 'remember' where you are.  Sorry about not giving code, but this question looks suspiciously like homework.  

Tom
0
 
LVL 20

Expert Comment

by:Venabili
ID: 8908438
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:

- Points for tomboshell  

Please leave any comments here within the next seven days.
 
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
 
Venabili
EE Cleanup Volunteer
0

Featured Post

Get real performance insights from real users

Key features:
- Total Pages Views and Load times
- Top Pages Viewed and Load Times
- Real Time Site Page Build Performance
- Users’ Browser and Platform Performance
- Geographic User Breakdown
- And more

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
In this post we will learn how to make Android Gesture Tutorial and give different functionality whenever a user Touch or Scroll android screen.
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …
This video teaches viewers about errors in exception handling.
Suggested Courses
Course of the Month13 days, 13 hours left to enroll

801 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question