
I'm creating a programming using array that will accept 10 letters and test if those letters are consonant, then it will display on the screen. Please guide me.
Sample Output:
Enter 10 letters.
A
B
C
D
E
F
G
H
I
J
The Consonants entered are
B
C
D
F
G
H
Program:
import java.io.*; public class Array {
public static void main(String args[]) throws IOException
{
BufferedReader k = new BufferedReader(new InputStreamReader(System.in));
char[] srcArray = new char[] = {'B', 'C', 'D', 'F', 'G','H','J','K','L','M','N','P','Q','R','S','T','V','W','X','Y','Z'};
char ch=;
System.out.println("Enter 10 letters");
for(int x=0;x<10;x++)
{
System.out.println(k.readLine());
}
if(ch==char[x])
{
//Don't know what to put here now.
}
else
System.out.println("Wrong Input!");
}
}
Help me out please.

hi friend,
Try this sample code may, this will be helpful for you.
package net.roseindia;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class CheckForVowel {
public static void main(String args[]) throws IOException
{
char n;
BufferedReader s=new BufferedReader (new InputStreamReader
(System.in));
System.out.println ("Enter letters : ");
String letter = s.readLine();
for(int i=0; i<letter.length(); i++)
{
n= letter.charAt(i);
if (n=='a'|| n=='e'|| n=='i'|| n=='o'|| n=='u'|| n=='A'||
n=='E'|| n=='I'|| n=='O'|| n=='U')
System.out.println ("Vowel = "+n);
else
System.out.println ("Consonant = "+n);
}
}
}
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.