Masukkan coding berikut, setelah:
public static void main(String[] args) {
Here Coding ----->
int data[]=new int['a'];
int menu, input=1, bantu, ada=0, nas;
String ambil=" ",urut = " ";
do{
menu=Integer.valueOf(JOptionPane.showInputDialog(".:MENU:.\n1.Input Data\n2.View Data\n3.Sort Data\n4.Search Data\n5.Exit"));
if(menu==1){
input=Integer.valueOf(JOptionPane.showInputDialog("Enter the amount of data : "));
for (int i=1;i<=input;i++){
data[i]=Integer.valueOf(JOptionPane.showInputDialog("Enter data to "+i+" "));
ambil=ambil+data[i]+" ";
}
}
if(menu == 2){
JOptionPane.showMessageDialog(null,"Views data "+ambil);
}
if(menu==3){
for(int i=1;i<=input;i++){
for(int j=i;j<=input;j++){
if(data[i]>data[j]){
bantu=data[i];
data[i]=data[j];
data[j]=bantu;
}
}
urut=urut+data[i]+" ";
}
JOptionPane.showMessageDialog(null,"Data are sorted from smallest reply "+urut);
}
if(menu==4){
int cari = Integer.parseInt(JOptionPane.showInputDialog("Search data = "));
for(nas=1; nas<=input; nas++) {
if(data[nas]==cari) {
ada = 1;
break;
}
}
if (ada == 1)
JOptionPane.showMessageDialog(null,"\nSearching For "+cari+"\n
There in the Index Data To "+nas);
There in the Index Data To "+nas);
else
JOptionPane.showMessageDialog(null,"Nothing");
}
}
while(menu!=5);
Zoom berikut:
Mantap Bro.. .
ReplyDeletesippp ok makasih sangt membantu
ReplyDeletesangat membantu... thank`s bro....
ReplyDelete