Saturday 27 August 2011

Contoh Program Mengubah Kode Huruf Ke ASCI dengan Read51:

Berikut buat para pembaca blog saya, ini ada contoh program yang di tujukan untuk mengubah input huruf dengan menjadikan outputnya dalam bentuk kode ASCI yang saya buat dengan menggunakan Read51:

import javax.swing.*;
import java.util.Scanner;

public class hurufkeasci
{
public static void main(String[]args)
{
Scanner input = new Scanner(System.in);
String str;
char a,b,c,d,e,f,g,h; System.out.print("huruf 1= ");
str = input.next();
a = str.charAt(0);
System.out.print("huruf 2= ");
str = input.next();
b = str.charAt(0);
System.out.print("huruf 3= ");
str = input.next();
c = str.charAt(0);
System.out.print("huruf 4= ");
str = input.next();
d = str.charAt(0);
System.out.print("huruf 5= ");
str = input.next();
e = str.charAt(0);
System.out.print("huruf 6= ");
str = input.next();
f = str.charAt(0);
System.out.print("huruf 7= ");
str = input.next();
g = str.charAt(0);
System.out.print("huruf 8= ");
str = input.next();
h = str.charAt(0);
System.out.println(""+a+" = "+(int)a);
System.out.println(""+b+" = "+(int)b);
System.out.println(""+c+" = "+(int)c);
System.out.println(""+d+" = "+(int)d);
System.out.println(""+e+" = "+(int)e);
System.out.println(""+f+" = "+(int)f);
System.out.println(""+g+" = "+(int)g);
System.out.println(""+h+" = "+(int)h);
System.exit(0);
}
}