Answer:
import java.util.ArrayList;
import java.util.List;
public class Vowels {
public static void main(String[] args) {
String word = "I am David from Nigeria";
System.out.println(which_vowels_present(word));
}
public static List which_vowels_present(String enteredWord){
List<Character>list = new ArrayList<>();
String word = enteredWord.toLowerCase();
for (int i =0; i<word.length(); i++){
if (word.charAt(i) == 'a' || word.charAt(i) == 'e' || word.charAt(i) == 'i'
|| word.charAt(i) == 'o' || word.charAt(i) == 'u') {
list.add(word.charAt(i));
}
}
return list;
}
}
Explanation:
- Using Java programming Language
- Import java.util.ArrayList; and java.util.List
- Create the method which_vowels_present which accepts a string parameter
- Within the method create a list object
- Use a for loop to iterate the string. within the for loop use an if statement to check individual characters of the string if any is a vowel, add it to the list
- return the list
- In the main method, create a test string, call the method and pass the string as parameter
Because you never know if the person over the phone is trying to scam you or not, so if you were to give them your ssn they would use your identity for stuff that they want. I hope this helps :)