/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package Daftar;
/**
*
* @author FIQI
*/
import java.util.Scanner;
public class Kamus {
public static void main(String[] args)
{
Scanner input=new Scanner (System.in);
String[][] kata={
{"ONE","SATU"},{"COW","SAPI"},{"RUN","LARI"},{"RED","MERAH"},{"PEOPLE","ORANG"}
,{"BLUE","BIRU"},{"SMART","PINTAR"}
};
String katadicari;
System.out.print("KATA YANG DI CARI = ");
katadicari=input.nextLine();
int i,k;k=-1;
for(i=0;i<7;i++)
{
if(kata[i][0].equals(katadicari.toUpperCase()))
{
k=i;
}
}
if(k==-1)
{
System.out.println("Kata Yang Di Cari Tidak Di Temukan");
}
else
{
System.out.println("TERJEMAHAN = "+kata[k][1]);
}
}
}
run:
KATA YANG DI CARI = cow
TERJEMAHAN = SAPI
BUILD SUCCESSFUL (total time: 4 seconds)
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package Daftar;
/**
*
* @author FIQI
*/
import java.util.Scanner;
public class Kamus {
public static void main(String[] args)
{
Scanner input=new Scanner (System.in);
String[][] kata={
{"ONE","SATU"},{"COW","SAPI"},{"RUN","LARI"},{"RED","MERAH"},{"PEOPLE","ORANG"}
,{"BLUE","BIRU"},{"SMART","PINTAR"}
};
String katadicari;
System.out.print("KATA YANG DI CARI = ");
katadicari=input.nextLine();
int i,k;k=-1;
for(i=0;i<7;i++)
{
if(kata[i][0].equals(katadicari.toUpperCase()))
{
k=i;
}
}
if(k==-1)
{
System.out.println("Kata Yang Di Cari Tidak Di Temukan");
}
else
{
System.out.println("TERJEMAHAN = "+kata[k][1]);
}
}
}
run:
KATA YANG DI CARI = cow
TERJEMAHAN = SAPI
BUILD SUCCESSFUL (total time: 4 seconds)
0 komentar:
Posting Komentar
: Ayoo sharingg.. :D