Mesran

Hanya ingin berbagi kebaikan dan mendapatkan kebaikan yang lain.

Latihan Latihan I/O pada Java 2 SE

Berikut ini masih latihan latihan input dengan menggunakan BufferReader

Berikut programnya :


import java.io.* ;
public class lat3{

    public static void main(String Arg[]) throws IOException{
    	double mid=0 ; double hadir =0 ; double uts=0 ;
    	double uas=0 ; double tugas =0 ; double na=0  ;
    	String npm ; String nama ;
    	String str ;
    	BufferedReader Get=new BufferedReader(new InputStreamReader(System.in)) ;

    	System.out.println("Menghitung Nilai Akhir Mahasiswa STMIK BUDIDARMA") ;

    	System.out.print("NPM          :")  ; str = Get.readLine() ;
    	System.out.print("Nama         :")  ; str = Get.readLine() ;

    	System.out.print("Nilai Hadir  : ") ; str = Get.readLine() ;
    	hadir = Integer.parseInt(str) ;

    	System.out.print("Nilai Tugas  : ") ; str = Get.readLine() ;
    	tugas = Integer.parseInt(str) ;

    	System.out.print("Nilai UTS    : ") ; str = Get.readLine() ;
    	uts = Integer.parseInt(str) ;

    	System.out.print("Nilai UAS    : ") ; str = Get.readLine() ;
    	uas = Integer.parseInt(str) ;

    	na  = 0.1 * hadir + 0.15 * tugas + 0.30 * uts + 0.45 * uas ;

    	System.out.println("Total Nilai  : " + na )  ;
    }

}

Simpan dengan nama lat3.java pada folder c:\java

Compile : c:\java\javac lat3.java

Running Program : c:\java\java lat3

Berikut Hasilnya

Filed under: Java 2 SE,

Terima kasih telah memberikan komentar anda.

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Archives Per Tahun

Sponsored

C&C Online Shop

Blog Stats

  • 356,504 sejak 12 Jan 2011

User’s Online


My Music

Enter your email address to follow this blog and receive notifications of new posts by email.

Join 223 other followers

March 2011
M T W T F S S
« Feb   Apr »
 123456
78910111213
14151617181920
21222324252627
28293031  
%d bloggers like this: