public class PerbaikanArray {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// TODO code
application logic here
//
String [] perhitungan= {"a","b","c","d","e","f","g","h","i","j"
,"k","l","m","n","o","p","q","r","s","t"
,"u","v","w","x","y","z","
"};
String []hasil=
{"G","K","M","W","Q","Y","X","Z","N","O","P",
"A","R","U","T","V","Z","H","J","L","B","C",
"D","E","F","I","7","5","3","2","6","8","9",
"4"};
String hasil = JOptionPane.showInputDialog(null, "Masukkan
hasil anda").toUpperCase();
char a[] = kode.toCharArray(); //
mengkonversi string ke char
for (int i = 0; i < a.length;
i++) { // inputan
for (int j
= 0; j < hasil.length; j++) { //output.an
if(String.valueOf(a[i]).equalsIgnoreCase(sandi[j]))
System.out.print(""+perhitungan[j]);
}
}
}
}
Perhitungan eksekusi =
perhitungan [] dieksekusi 1 kali
hasil [] dieksekusi 1 kali
i=0 dieksekusi 1 kali
i<a.lenght dieksekusi n kali
i++ dieksekusi n kali
j=0 dieksekusi 1 kali
j<hasil.lenght dieksekusi m kali
j++ dieksekusi m kali
ir dieksekusi 1+m kali
5+2n+3m
=> jadi 2n+107
Jumlah = m=34
5+2n+3.34
5+2n+102
2a+107
Posted by 01.50 and have
0
komentar
, Published at
Tidak ada komentar:
Posting Komentar