• Post Reply Bookmark Topic Watch Topic
  • New Topic

integer value in Alphabets form Command prompt  RSS feed

 
Kamran Mughni Siddiqui
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is there any Class in Java which can takes Integer from Command Prompt and print it in Alphabets.If there is no such class in Java how can we do that???
e.g:
If we give 18 from Command prompt and we get the output "Eighteen"
 
Michael Ernest
High Plains Drifter
Sheriff
Posts: 7292
Netbeans IDE VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You'd have to write a program that parses such input and outputs the appropriate cardinal or ordinal value. There are lots of ways to do this, but there's no class I'm aware of that does it for you.
In fact, this is a good opportunity to think about internationalization. If we're all using the same numeric notation, why not write *one* program that provides language translation, and then produce a file for each language you'd like to do the translations in?
The English file would of course look like:
1=one
2=two
3=three
but if you wanted to support Spanish, you'd have:
1=uno
2=dos
3=tres
then you'd pick which file is appropriate according to the locale of the user's system. Sound interesting?
------------------
Michael Ernest, co-author of: The Complete Java 2 Certification Study Guide
 
Kamran Mughni Siddiqui
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi dear Michael Ernest,

yes I wanna Write a program with following specifications.... But I have no clue how to began!!!
* Program takes any integer value (b/w 1 to 100) from command prompt.
* Write code to print this integer value in Alphabets.
Example:
1) 59 (input)
Fifty Nine. (output)
2) 76 (input)
Seventy Six (output
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!