main huruf yang sederhana

Dari pada pusing mending ngoding yang ringan-ringan, :p

method kata
public String kata(String input){
char [] arc = input.toCharArray();
StringBuilder sb = new StringBuilder();
for (char ch : arc){
ch = balik(ch);
sb.append(ch);
}
return sb.toString();
}

method balik

public char balik(char c){
        char retChar = 0;
        if (c == 'A'){
            retChar = 'D';
        }else if (c == 'B'){
            retChar = 'E';
        }else if (c == 'C'){
            retChar = 'F';
        }else if (c == 'D'){
            retChar = 'G';
        }else if (c == 'E'){
            retChar = 'H';
        }else if (c == 'F'){
            retChar = 'I';
        }else if (c == 'G'){
            retChar = 'J';
        }else if (c == 'H'){
            retChar = 'K';
        }else if (c == 'I'){
            retChar = 'L';
        }else if (c == 'J'){
            retChar = 'M';
        }else if (c == 'K'){
            retChar = 'N';
        }else if (c == 'L'){
            retChar = 'O';
        }else if (c == 'M'){
            retChar = 'P';
        }else if (c == 'N'){
            retChar = 'Q';
        }else if (c == 'O'){
            retChar = 'R';
        }else if (c == 'P'){
            retChar = 'S';
        }else if (c == 'Q'){
            retChar = 'T';
        }else if (c == 'R'){
            retChar = 'U';
        }else if (c == 'S'){
            retChar = 'V';
        }else if (c == 'T'){
            retChar = 'W';
        }else if (c == 'U'){
            retChar = 'X';
        }else if (c == 'V'){
            retChar = 'Y';
        }else if (c == 'W'){
            retChar = 'Z';
        }else if (c == 'X'){
            retChar = 'A';
        }else if (c == 'Y'){
            retChar = 'B';
        }else if (c == 'Z'){
            retChar = 'C';
        }else{
            retChar = ' ';
        }
        return retChar;
    }

Hasil

Published by

saifiahmada

Begin a big Process with a bit trying

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s