Mesran

Hanya ingin berbagi kebaikan dan mendapatkan kebaikan yang lain.

Latihan Kendali if () Jamak

Nama File lat6.java


import java.io.* ;
public class lat6{

    public static void main(String Arg[]) throws IOException{
    	String str ; String NIP ; String Nama ;String jbt ;
    	double gaji=0 ; double pajak =0 ; double total=0 ;
    	int Kdj ;
    	BufferedReader Get=new BufferedReader(new  InputStreamReader(System.in)) ;
    	System.out.print("NIP        	: ")  ; NIP = Get.readLine() ;
    	System.out.print("Nama    	: ")  ; Nama = Get.readLine() ;
    	System.out.print("Kode     	: ")  ; str = Get.readLine() ;
    	Kdj = Integer.parseInt(str) ;

    	if (Kdj==1) {
    		jbt = "Direktur"  ; gaji = 5000000 ;
    	} else if (Kdj==2) {
    		jbt = "Wakil Direktur"  ; gaji = 4000000 ;
    	} else if (Kdj==3) {
    		jbt = "Bendahara"  ; gaji = 3000000 ;
    	} else if (Kdj==4) {
    		jbt = "Staf"  ; gaji = 2000000 ;
    	} else {
    		jbt = ""  ; gaji = 0 ;
    	}

    	pajak = 0.1 * gaji ;
    	total = gaji-pajak ;
    	System.out.println("Jabatan   : " + jbt )  ;
    	System.out.println("Gaji      : " + gaji)  ;
    	System.out.println("Pajak     : " + pajak )  ;
    	System.out.println("Total     : " + total )  ;
    }

}

Filed under: Java 2 SE,

2 Responses

  1. […] Latihan Kendali if () Jamak  Dengan Perulangan Do While […]

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

%d bloggers like this: