Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Converting char to int

 
Joshua Mccartney
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please help me here..

using if/else condition, that determines if the input is a vowel or consonant.

..
 
Greg Brannon
Bartender
Posts: 563
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
char primitives are themselves numbers or can be treated as numbers. See if this simple program helps illustrate my point:

See if that coupled with an ASCII table gives you some ideas how to accomplish the assignment.
 
Rob Spoor
Sheriff
Pie
Posts: 20533
54
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Greg Brannon wrote:

Note that the parentheses around 'c' are not necessary; (int) 'c' will work just as fine.
See if that coupled with an ASCII table gives you some ideas how to accomplish the assignment.

And you can find such a table on http://www.asciitable.com.
 
Winston Gutkowski
Bartender
Pie
Posts: 10417
63
Eclipse IDE Hibernate Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Joshua Mccartney wrote:using if/else condition, that determines if the input is a vowel or consonant.

It really depends on how sophisticated you want this to be; and you also need to allow for the fact that a character may be
  • neither.
  • both (in English, the letter 'y' is often characterised as such).

  • Personally, I'd start out with Character.isLetter() and work from there.

    BTW, I have no idea what this has to do with your subject line.

    Winston
     
    • Post Reply
    • Bookmark Topic Watch Topic
    • New Topic