import java.util.Scanner;
public class exampaper
{
public static void main(String args[])
{
Scanner scan = new Scanner(System.in);
int count=0;
int count1=1;
int count2=0;
// boolean t =false;
System.out.println("Please enter a sentence");
String s1=scan.nextLine();
while(!s1.equals("END"))
{
System.out.println(s1);
s1=scan.nextLine();
if(s1.equals("END"))
{
System.out.println("END");
}
}
for(int i=0;i<s1.length();i++)
{
if(s1.charAt(i)==' ')
{
count1++;
}
else if(s1.charAt(i)=='a'||s1.charAt(i)=='A')
{
count++;
}
else if(s1.charAt(i)=='e'||s1.charAt(i)=='E')
{
count++;
}
else if(s1.charAt(i)=='i'||s1.charAt(i)=='I')
{
count++;
}
else if(s1.charAt(i)=='o'||s1.charAt(i)=='O')
{
count++;
}
else if(s1.charAt(i)=='u'||s1.charAt(i)=='U')
{
count++;
}
else
{
count2++;
}
}
System.out.println("Number of vowels: " +count);
System.out.println("Number of words: " +count1);
System.out.println("Number of non-vowels: " +count2);
}
}
私は数えられません。母音、母音、母音以外の母音の場合はwhileループを繰り返して質問をしてください。何が間違っているのか分かりません。誰かが提案please.Thanksに私にユーザーに文章を繰り返し入力する方法と、ユーザーがENDを入力した場合には停止する必要があります。母音、母音、母音以外のものを含む。
[単語、母音、母音以外の数を決定するプログラムを作成し、プログラムがユーザーにSTOPを入力するまで文章を入力し続ける必要があります](http://stackoverflow.com/questions/40916778/write- a-program-that-determined-the-words-words-母音 - 非母音とプログラム) – AJNeufeld