Write a program in Java to count the words that end in vowels in given sentences:
Prompt the user for one string: userStr.
Print the number of words ending in vowels.
The method Character.isLetter() tests if a character is an alphabetic letter (A-Z, a-z). E.g. Character.isLetter(‘a’) is true and Character.isLetter(‘.’) is false.
Convert the String userStr to an array of characters called userStrArray.This step is just one line of code:
char userStrArray = userStr.toCharArray();
Repeat step 2, using the character array userStrArray instead of the String userStr, to count the number of words (in the array) ending in vowels.
It will be the same number of words as the first one.
Do not use userStr in step 4. Use only userStrArray.
Ask the user for another string and, unless the string is “exit”, repeat steps 2, 3, 4, 5.
Steps 1, 2, 3, 4, 5 must execute at least once, even if the user enters “exit” for the first string.
Only start checking for “exit” when the user enters the second string (and subsequent strings).
When the user enters “exit”, display a message stating the total number of words ending in vowels (in all sentences combined).
The comparisons are NOT case-sensitive.
You must use a switch statement to compare each character in userStr to the vowels.
Do not use if statements to check if the character is one of the vowels.
Do not put the vowels on a list, array, or a string of vowels.
NO split(), NO Parser, NO Matcher…
DO NOT create your own methods. Everything must be in the main method.