Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Java > Java and JDK > Java Basics
|
Java Basics General beginning Java language questions that don't fit in one of the more specific forums. Please specify what version.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Java Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old July 22nd, 2007, 02:51 AM
Registered User
 
Join Date: Jul 2007
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default help ! ! ! ! ! ! ! ! ! ! !

please help me on how to create a program that convert numeric into string for example "1" turns into "one" and so on...


thanks ! ! ! ! :)

 
Old July 23rd, 2007, 03:22 PM
Authorized User
 
Join Date: Sep 2006
Posts: 39
Thanks: 0
Thanked 0 Times in 0 Posts
Default

An array. I would make an array something like this to start off with.

Code:
String numtostring[] = {"zero", "one", "two", ....}
Then you would read the users input, convert it to an integer, and get the array value by saying:

Code:
//user_input_int is the integer the user's input.
numtostring[user_input_int];
or something like that

This may not be the most efficient way if you want to write out a number like 1000 as one thousand. You would probably need more arrays or something. Anyway, I hope this helps :)

"Judge a man by his questions, not by his answers."
-Voltaire









Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.