package scanner;
import java.util.Scanner;
public class GuessSentence {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.println("Type a sentence");
String sentence = sc.nextLine();
System.out.println("You entered the sentence " + sentence);
System.out.println("The number of words in the sentence is " + sentence.length());
char [] chars=sentence.toCharArray();
int count = 0;
for (char c : chars) {
switch(c) {
case 'a':
case 'e':
case 'i':
case 'o':
case 'u':
count++;
break;
}
}
System.out.println("The numner of vowels in your sentence is " + count);
System.out.println("The percentage of vowels is " + 100 * count /sentence.length() + "%" );
}
}
Thank you to everyone who helped, I was able to get the correct outcome which i was looking for so i appreciate all the help recieved.