Question: 3.2 Task 2: getVowels () Write a method getVowels that takes a string as parameters and returns the number of vowels present in that

3.2 Task 2: getVowels () Write a method getVowels that takes a

3.2 Task 2: getVowels () Write a method getVowels that takes a string as parameters and returns the number of vowels present in that string. Vowels of the English alphabet are the letters: a, e, i o, and u. The string can be in upper case or lower case letters, or contain both upper and lower case letters. Hint: use the String class method charAt(index) that returns the character at a given index. Examples: Call getVowels ("Hello") Value Returned 2 getVowels ("I love JAVA") 5 getVowels (AbEeRr) 2 3.3 Task 3: switchLetterCase() Write a method switchLetterCase that takes a string as an input. The method should identify whether the characters in the string are in uppercase or lowercase, then changes all the lowercase characters, if any, to uppercase and vice versa. Hint: Use the isLowerCase() method (returns a Boolean) in the Character class by making the call Character.isLowerCase(char c). It identifies if the character is in lower case mode or not. Also, use the methods of the String class such as charAt(index) that returns the character at a given index of the string, and substring() to get part of the string). Examples: Call switchLetterCase ("Hello") switchLetterCase("I love JAVA") switchLetterCase("York UNIV.") Value Returned "HELLO" "i LOVE java" "YORK univ.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!