Rabu, 04 Mei 2011

CLASS KAMUS

package class kamus;

import java.util.Scanner;
class kamus {
public static void main (String [] args) {
   Scanner input = new Scanner (System.in);
   
    String [] [] kata = {
    {"ADUS","MANDI},{"DOLANAN","MAIN"},{"TUKU","BELI"),("MANGAN","MAKAN"},
    {"AJA","JANGAN"}
    };
    String kata dicari;
   
    System.out.println{"KATA YANG DICARI"};
    kata dicari = input.nextLine( );
    int i,k;k = -1;
    for ( i = 0; i<5; i++)
   {
       if (kata [i] [0].equals (kata dicari.touppercase( ) ) )
   {
       k = i;
   }
   }
      if ( k = = -1 )
  {
       System.out.println ("kata yang dicari tidak ditemukan");
  }
     else
  {
      System.out.println ("terjemahan = " + [k] [1] );
      }
  }
}

0 komentar:

Posting Komentar