Posted by : Unknown Sunday, September 18, 2011

Contoh Program BufferedReader
package contoh2;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;
public class Main
{
public static void main ( String[] args ) throws IOException {
BufferedReader dataIn = new BufferedReader(new InputStreamReader( System.in) );
String nama;
int nilai;
try{
System.out.print (“Ketikkan nama = “);
nama = (dataIn.readLine());
System.out.print (“Masukkan nilai = “);
nilai = Integer.parseInt(dataIn.readLine());
if (nilai >= 80){
System.out.println(“Ketikkan Nama Anda : ” +nama+ “Nilai Anda : ” +nilai+ “predikat A”);}
else
if (nilai >= 70){
System.out.println(“Ketikkan Nama Anda : ” +nama+ ” Nilai Anda : ” +nilai+ ” predikat B”);}
else
if (nilai >= 60){
System.out.println(“Ketikkan Nama Anda : ” +nama+ ” Nilai Anda : ” +nilai+ ” predikat C”);}
else
if (nilai >= 50){
System.out.println(“Ketikkan Nama Anda : ” +nama+ ” Nilai Anda : ” +nilai+ ” predikat D”);}
else {
System.out.println(“Ketikkan Nama Anda : ” +nama+ ” Nilai Anda : ” +nilai+ ” predikat E”);}
}
catch( NumberFormatException e ){
System.out.println(“Error!”);
System.exit(1);
}
}
}

Sumber: http://andrie07.wordpress.com/2010/11/12/contoh-program-bufferedreader-contoh-program-joptionpane/

Leave a Reply

Silahkan berikan komentar disini...

Subscribe to Posts | Subscribe to Comments

Computing Cup 2011 Banner

Computing Cup Banner

Clock

Calendar

Popular Post

Blog Archive

Powered by Blogger.

- Copyright © Sharing & Tutorial -Metrominimalist- Powered by Blogger - Designed by KoplakerZ™ -