English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

it is a question for java students

2006-07-21 14:35:00 · 4 answers · asked by Anonymous in Computers & Internet Programming & Design

4 answers

public int countVowels( String word ) {

int count = 0;

if( word != null ) {

for( int i = 0; i < word.length(); i++) {
if( "aeiouAEIOU".indexOf( word.charAt( i ) ) >= 0 ) count++;
}

}

return count;
}

2006-07-24 07:17:24 · answer #1 · answered by BalRog 5 · 1 0

I will provide some psuedo code for it.

make a counter and set it to 0
while there are letters left in the word
get the next letter // will be the first letter the first time around
if this letter is a vowel // a, e, i, o, u
increment the counter by 1
end if
end while


At the end, you will have the counter with the number of vowels.

You could use char == 'a' for the testing.

2006-07-21 19:45:26 · answer #2 · answered by Mark aka jack573 7 · 0 2

Are you extreme? The bible is God's observe or inspite of and once you're preserving "properly do not in basic terms study that reason it received't make experience study the student's writing too" then you definitely're preserving the bible received't make experience and also you mustn't ought to study any student's writing's to appreciate the bible. The bible is meant to be the words to stay by skill of and in case you favor to more suitable recognize it with pupils writing's then you definitely recognize on your heart the bible is organic crap.

2016-12-10 13:17:43 · answer #3 · answered by Anonymous · 0 0

gsatish why would I write program for you when I am not student but I am a JAVA teacher and programmer my-self?

2006-07-24 23:59:30 · answer #4 · answered by Joe_Young 6 · 0 2

fedest.com, questions and answers