Yahoo Answers is shutting down on May 4th, 2021 (Eastern Time) and beginning April 20th, 2021 (Eastern Time) the Yahoo Answers website will be in read-only mode. There will be no changes to other Yahoo properties or services, or your Yahoo account. You can find more information about the Yahoo Answers shutdown and how to download your data on this help page.

im having problems with my java program?

this is what i have to do

Write a recursive method named extractNonVowels. This method shall

take a String s as a parameter and returns a String without any non-

vowel. For example: If the String s = ``Hello world", after calling

extractVowels, the String shall be ``eoo"

this is what i have

public class FIndVowels

{

public static void main(String [] args)

{

System.out.println(extracNontVowels("bananas"));

}

public static String extractNonVowels(String s)

{

if(s.length() <= 0)

{

return s;

}

else

{

if(s.charAt(0)=='a'||s.charAt(0)=='A')

return extractNonVowels(s.substring(1)) + s.charAt(0);

if(s.charAt(0)=='o'||s.charAt(0)=='O')

return extractNonVowels(s.substring(1)) + s.charAt(0);

if(s.charAt(0)=='e'||s.charAt(0)=='E')

return extractNonVowels(s.substring(1))+ s.charAt(0);

if(s.charAt(0)=='i'||s.charAt(0)=='I')

return extractNonVowels(s.substring(1)) + s.charAt(0);

if(s.charAt(0)=='u'||s.charAt(0)=='U')

return extractNonVowels(s.substring(1)) + s.charAt(0);

}

return extractNonVowels(s.substring(1));

}

}

im currently stucl

1 Answer

Relevance
Still have questions? Get your answers by asking now.