Mesran

Hanya ingin berbagi kebaikan dan mendapatkan kebaikan yang lain.

Latihan Struktur Kendali if()

Nama File lat 5.java

Ketikkanlah program berikut ini :


import java.io.* ;
public class lat5{

    public static void main(String Arg[]) throws IOException{
    	String str ;
    	double penjualan=0 ; double disc =0 ;

    	BufferedReader Get=new BufferedReader(new InputStreamReader(System.in)) ;
    	System.out.print(”Jumlah Penjualan : ”)  ;  str = Get.readLine()  ;

    	penjualan= Double.parseDouble(str) ;
    	
	if (penjualan > 4000000) {
    		disc = 0.1 * penjualan  ;
    	} else {
    		disc = 0 ;
    	}

    	System.out.println(”Discount: ” + disc)  ;
    }

}

Jalankanlah program tersebut diatas, dan berikanlah 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

  • 355,909 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: