Nama : Mochammad Buyung Eliyasah
NIM : 2012420044
Kelas : A
package run;
import javax.swing.JOptionPane;
public class Run {
public static void main(String[] args) {
String[]mama ={"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[]papa = {"10","20","30","40","50","60","70","80","90","00","11","21",
"31","41","51","61","71","81","91","01","12","22","32","42","52","62","72"
,"",""
};
String kode =JOptionPane.showInputDialog(null,"masukkan sandi anda");
char[] adek = kode.toCharArray();
for (int i=0;i<adek.length;i++){
for (int j=0;j<mama.length;j++){
if (String.valueOf(adek[i]).equalsIgnoreCase(mama[j]))
System.out.println(papa[j]);
}
}
System.out.println("");
}
}
//Perhitungan
String [] mama 1x
String [] papa 1x
String kode 1x
char [] adek nx
i = 0; 1x
i<adek.length; nx
i++; nx
j=0; 1x
j<mama.length; n x n
j++; n x n
String.valueOf(adek[i]).equalsIgnoreCase(mama[j]) nx
System.out.print(papa[j]); n x n
System.out.print(“ ”); 1x
6 + 4n + 3n2 kali --> T (n) = O (n2)
Posted by 09.01 and have
0
komentar
, Published at
Tidak ada komentar:
Posting Komentar