/*
* To change this
template, choose Tools | Templates
* and open the
template in the editor.
*/
package main;
import javax.swing.JOptionPane;
/**
*
* @author Thosiba
*/
public class UTS2 {
/**
* @param args the
command line arguments
*/
public static void
main(String[] args) {
// TODO code
application logic here
String []aa
={"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 []
sd={"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 [] c =
kode.toCharArray();
for (int i = 0;
i < c.length; i++) {
for (int j =
0; j < aa.length; j++) {
if(String.valueOf(c[i]).equalsIgnoreCase(aa[j])) {
System.out.print(sd[j]);
}
}
}
System.out.println("");
}
}
String []aa
={"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"," "}; 1x
String []
sd={"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"}; 1x
char [] c =
kode.toCharArray(); nx
i = 0; 1x
i<c.length; nx
i++; nx
j=0; 1x
j<aa.length; n
x n
j++; n
x n
String.valueOf(c[i]).equalsIgnoreCase(aa[j]) nx
System.out.print(sd[j]); n
x n
System.out.print(“ ”); 1x
6 + 4n + 3n2 kali ---->> T (n) = O (n2)
Nama : Bagus Dermawan
Nim : 2012420050
Posted by 02.19 and have
0
komentar
, Published at
Tidak ada komentar:
Posting Komentar