I will count your vowels. Enter your sentences. Hit enter when done Sentence (hit ENTER when done):Once upon a midnight dreary Sentence (hit ENTER when done):while I pondered Sentence (hit ENTER when done):weak Sentence (hit ENTER when done):and Sentence (hit ENTER when done):weary Sentence (hit ENTER when done): There are 20 vowels. There are 11 words.
You can assume that there is always a space between every two words, but remember that there could be a line with just one word, and no spaces, as the above example shows.
Hint: use
Scanner.nextLine()
to read the whole line.Hint: use
String.charAt
As always, turn it in at the dropbox.cse.sc.edu, Lab 8.
No comments:
Post a Comment