CS174: OOP - Drills - Vowel Counting
Developed by Professor Tralie and Professor Mongan.
Exercise Goals
The goals of this exercise are:- To do proper string indexing
- To use conditional statements appropriately
- To keep track of auxiliary variables within loops
countVowels
to count the number of vowels (both lowercase and uppercase, not including y or Y) in a string. Recall that the method charAt
of the String
class returns a character at a particular index, and, like arrays, strings are zero-indexed. For instance, if String s = "I love CS";
s.charAt(3)
o
.Recall also that the length()
method of the String
class returns the total number of characters in the string.