Bahasa Indonesianya : Teman-teman, coba java source code ini untuk menghitung kecocokan diantara dua nama.
Please Download here TrueLove2
Nih tammpilan source codenya :
import javax.swing.JOptionPane;
public class TrueLove2 {
String nama1, nama2;
int point[] = new int[8];
public TrueLove2() {
JOptionPane.showMessageDialog(null, "Program True Love untuk menghitung \n kecocokan diantara dua nama", "True Love", JOptionPane.PLAIN_MESSAGE);
}
public void inputNama() {
int a;
do {
this.nama1=JOptionPane.showInputDialog("Masukkan nama pertama :");
a=nama1.length();
} while(a < 1);
do {
this.nama2=JOptionPane.showInputDialog("Masukkan nama kedua :");
a=nama2.length();
} while(a < 1);
}
public void hitung(int cendol[],String xnama) {
int b;
b=xnama.length();
for(int i=0;i switch(xnama.charAt(i)) {
case 't' : cendol[0]++; cendol[0] %= 10; break;
case 'r' : cendol[1]++; cendol[1] %= 10; break;
case 'u' : cendol[2]++; cendol[2] %= 10; break;
case 'e' : cendol[3]++; cendol[7]++; cendol[3] %= 10; cendol[7] %= 10; break;
case 'l' : point[4]++; point[4] %= 10; break;
case 'o' : point[5]++; point[5] %= 10; break;
case 'v' : point[6]++; point[6] %= 10; break;
}
}
}
public void hitungPersen() {
hitung(point,nama1);
hitung(point,nama2);
for(int i=3;i>0;i--) {
for(int j=0;j point[j]=(point[j]+point[j+1]) % 10;
point[j+4]=(point[j+4]+point[j+5]) % 10;
}
}
}
public void cetakHasil() {
JOptionPane.showMessageDialog(null,"Kecocokan antara "+nama1+" dan "+nama2+" adalah "+point[0]+point[4]+"%", "Hasil", JOptionPane.PLAIN_MESSAGE);
}
public static void main(String args[]) {
TrueLove2 tl= new TrueLove2();
tl.inputNama();
tl.hitungPersen();
tl.cetakHasil();
System.exit(0);
}
}
Selamat Mencoba good luck
1 komentar:
The King Casino: The New King & The World of Gaming
The King Casino is the new place where the real money gambling is https://jancasino.com/review/merit-casino/ legal in Florida and Pennsylvania. We love goyangfc.com the new 도레미시디 출장샵 casino. We've งานออนไลน์ got some titanium flat iron great
Posting Komentar