I guess you can use 2 arrays of char for the choices
CODE
import javax.swing.JOptionPane;//Imports Dialog box in program
public class VowelsConsonants
{
public static void main (String[] args)
{
int choice, again = 0;
char[] voyel = {'a', 'e', 'i', 'o', 'u'};
char[] consonant = {'b', 'c', 'd', 'f', 'g','h','j','k','l','m','n','p','q','r','s','t','v','w','x','y','z'};
choice = JOptionPane.showConfirmDialog (null, "Would you like to play the Vowel/Consonant game?, Please Choose Yes, No, or Cancel!");//user decides wether to play game
char letter;
if (choice == JOptionPane.YES_OPTION)//user plays the game if he/she chooses the "Yes" option.
{
do
{
boolean typeFound = false;
String str = JOptionPane.showInputDialog ("Please enter a letter from A-Z: ");//user enters a letter from a-z
str = str.toLowerCase();
letter = str.charAt(0);
for(int i = 0; i < voyel.length; i++) {
if(letter == voyel[i]) {
JOptionPane.showMessageDialog (null, "You have entered a vowel.");//tells the user whether he/she entered a vowel or not
typeFound = true;
break;
}
}
// OK was a vowel
if(typeFound)
continue;
for(int i = 0; i < consonant.length; i++) {
if(letter == consonant[i]) {
JOptionPane.showMessageDialog (null, "You have entered a consonant.");//tells the user whether he/she entered a consonant or not
typeFound = true;
break;
}
}
// OK was a consonant
if(typeFound)
continue;
JOptionPane.showMessageDialog (null, "Error: Invalid Input, No Symbols, Numbers, or Spaces Please");
again = JOptionPane.showConfirmDialog (null, "Would you like to try again? ");//ask user if he/she wants to try again
}while (again == JOptionPane.YES_OPTION);//user plays the game until they choose "No" or "Cancel"
}
}
}