Solved

converting digits into numbers

Posted on 2001-09-06
3
420 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
3 Comments
 
LVL 7

Accepted Solution

by:
tomboshell earned 30 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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
couple of eclipse 5 46
Desingning Refactoring existing code 2 26
ejb on wildfly 5 30
Selenium docs api java index 3 48
Introduction Java can be integrated with native programs using an interface called JNI(Java Native Interface). Native programs are programs which can directly run on the processor. JNI is simply a naming and calling convention so that the JVM (Java…
Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.

839 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