Solving this question in edabit: https://edabit.com/challenge/7cugwZK74ciMmFqHe using the Strong.toLowerCase and then a for loop that adds up the vowels to get the answer!
The question didn't feel that hard, so not sure why hard difficulty
I'm wondering how I can do more difficult questions. I think that I am going sideways with how things are going. I need more challenges
Question:
Answer:
public class VowelSummation {
public static int sumOfVowels(String str) {
int count = 0;
String newStr = str.toLowerCase();
for(int i = 0; i < newStr.length(); i++) {
if(newStr.charAt(i) == 'a')
count += 4;
if(newStr.charAt(i) == 'e')
count += 3;
if(newStr.charAt(i) == 'i')
count += 1;
}
return count;
}
}