• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Command Line

 
Kabs Pvt
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
May i know plz if i entered a value through command line
java class_name 25
then the complier will print Twenty Five

Complier will print In words is it possible for me, cindy will you tell me please.
 
James Swan
Ranch Hand
Posts: 403
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There is no built in java API to do this (ie. you have to write the algorithm yourself).
Go to google and try searching on "numbers to words" or "cheque printer" algorithms.
Anyway here is a VB example to get you started.
http://www.citilink.com/~jgarrick/vbasic/tips/num2word.html
James.
 
Dave Vick
Ranch Hand
Posts: 3244
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Kabs
The command line arguments supplied to a program are sent to the main method as an array of Strings. So, if you entered java class_name 25 then the variable args[0] would hold the String "25". I dont know of any standard way to convert the "25" to the words "twenty-five". Someone else may know of a package out there that does this or you may have to write it yourself.
hope that helps


------------------
Dave
Sun Certified Programmer for the Java� 2 Platform
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic