import java.util.Scanner;
public class array_2_dimensi
{public static void main (String[] args)
{ Scanner input=new Scanner(System.in);
String [][] kata={
{"one","satu"},{"cow","sapi"},{"run","lari"},{"red","merah"},{"man","orang"}
};
String katadicari;
System.out.print("Kata Yang Di Cari = ");
katadicari=input.nextLine();
int i,k;k=-1;
for (i=0;i<5;i++)
{
if(kata[i][0].equals(katadicari))
{
k=i;
}
}
if (k==-1)
{System.out.println ("kata yang di cari tidak ditemukan");
}
else
{
System.out.println("terjemahan = "+kata [k][1]);
}
}
}
Tidak ada komentar:
Posting Komentar