
program to generate six letters in lower case and check if some of those letters are vowels..please help

Here is a java example that generates six letters and check if it consists of any vowel.If vowel exists, it will display the no of vowels.
class GenerateLetters{
public static void main(String[] args){
String alphabet="abcdefghijklmnopqrstuvwxyz";
String st = "";
String str="";
int count=0;
for (int i = 0; i < 6; i++) {
st += alphabet.charAt((int) (Math.random() * alphabet.length()));
}
System.out.println(st);
for (int i = 0; i < st.length(); i++) {
char c = st.charAt(i);
if (c=='a' || c=='e' || c=='i' || c=='o' || c=='u') {
count++;
str+=c+" ";
}
}
if(count>1){
System.out.println("There are" + " " + count + " " + "vowels in the generated string.They are: "+str);
}
else{
System.out.println("String is not having any vowel.");
}
}
}
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.