Created
March 18, 2018 05:36
-
-
Save abdullahainun/97cbeb310d76d76c355eaea84703228a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.Scanner; | |
public class No3 { | |
public static void main(String[] args) { | |
Scanner input1 = new Scanner(System.in); | |
System.out.println("masukkan kalimat :"); | |
String kalimat = input1.nextLine(); | |
char[] kata = kalimat.toCharArray(); | |
char hurufDepan = kata[0]; | |
char hurufBelakang = kata[kata.length-1]; | |
for (int i = 0; i < kata.length; i++) { | |
if(i == 0){ | |
continue; | |
} | |
else if (kata[i] == 'a') { | |
kata[i] = hurufBelakang; | |
} | |
else if (kata[i] == 'i') { | |
kata[i] = hurufBelakang; | |
} | |
else if (kata[i] == 'u') { | |
kata[i] = hurufBelakang; | |
} | |
else if (kata[i] == 'e') { | |
kata[i] = hurufBelakang; | |
} | |
else if (kata[i] == 'o') { | |
kata[i] = hurufBelakang; | |
}else if (i == kata.length-1){ | |
continue; | |
} | |
} | |
kata[0] = hurufBelakang; | |
kata[kata.length - 1] = hurufDepan; | |
System.out.println(kata); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment