Advertisement
Guest User

Untitled

a guest
Sep 26th, 2016
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.72 KB | None | 0 0
  1. public static void ex_4(String str){
  2. String nova = " ";
  3. for(int i=0; i<str.length(); i++){
  4. if (i == str.length()-1){
  5. nova = nova.concat("" + str.charAt(i));
  6. break;
  7. }
  8. if(isVowel(str.charAt(i)) && isVowel(str.charAt(i+1))){
  9. nova = nova.concat(""+str.charAt(i)+"p");}
  10. else{
  11. nova = nova.concat(""+str.charAt(i));
  12. }
  13. }
  14. System.out.printf("%s", nova);
  15. }
  16.  
  17. public static boolean isVowel(char i){
  18. String vogais = "aeiou";
  19. for(int k = 0; k<vogais.length(); k++){
  20. if(vogais.charAt(k) == i) return true;
  21. }
  22. return false;
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement