Welcome to Dream.In.Code
Become a Java Expert!

Join 149,513 Java Programmers for FREE! Get instant access to thousands of Java experts, tutorials, code snippets, and more! There are 1,355 people online right now. Registration is fast and FREE... Join Now!




Identifying vowels and constants

 
Reply to this topicStart new topic

Identifying vowels and constants, how?

Mastergeek666
16 Aug, 2007 - 09:23 AM
Post #1

D.I.C Head
Group Icon

Joined: 10 Aug, 2007
Posts: 120


Dream Kudos: 75
My Contributions
/**
* @(#)Integers.java
*
* Integers application
*
* @author
* @version 1.00 2007/8/16
*/
import javax.swing.JOptionPane;

public class Integers
{

public static void main(String[] args)
{
String numStr, result;
int num, again;

do
{
numStr = JOptionPane.showInputDialog ("Enter an integer: ");

num = Integer.parseInt(numStr);

result = "That number is " + ((num%2 == 0) ? "even" : "odd");

JOptionPane.showMessageDialog (null, result);

again = JOptionPane.showConfirmDialog (null, "Do Another?");
}
while (again == JOptionPane.YES_OPTION);
}
}

This is the code I'm using to find whether or not a number is an even or odd number but how could I make it identify letters?
User is offlineProfile CardPM
+Quote Post

no2pencil
RE: Identifying Vowels And Constants
16 Aug, 2007 - 09:26 AM
Post #2

My fridge be runnin OH NOEZ!
Group Icon

Joined: 10 May, 2007
Posts: 7,121



Thanked: 76 times
Dream Kudos: 2425
Expert In: Goofing Off

My Contributions
I would make an array of 'a','e','i','o','u' & check the letters individually vs every element of that array.
User is online!Profile CardPM
+Quote Post

Mastergeek666
RE: Identifying Vowels And Constants
16 Aug, 2007 - 09:31 AM
Post #3

D.I.C Head
Group Icon

Joined: 10 Aug, 2007
Posts: 120


Dream Kudos: 75
My Contributions
Thx! That makes sense now.
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 1/7/09 07:48PM

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter

Live Java Help!

Java Tutorials

Reference Sheets

Java Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month