RSS

program akses dalam dan luar scope

04 May

package bangke.tong.zampah;
import java.util.*;

public class akses_dalam_dan_luar_scope{
public static void main(String[]bless){
Scanner s=new Scanner(System.in);
System.out.println(“”);
System.out.println(“\t\tAKSES DIDALAM DAN DILUAR SCOPE”);
System.out.println(“\t\t******************************”);
System.out.println(“”);
System.out.println(“\t\tAKSES DIDALAM SCOPE”);
System.out.println(“\t\t*******************”);
System.out.print(“\t\tMasukan nilai pertama : “);
int nilai1=s.nextInt();
System.out.print(“\t\tMasukan nilai kedua : “);
int nilai2=s.nextInt();
int nilai=nilai1+nilai2;
System.out.println(“\t\tNilai penjumlahan : “+nilai1+” + “+nilai2+” = “+nilai);
akses_dalam_dan_luar_scope akses=new akses_dalam_dan_luar_scope();
akses.pengurangan(nilai1,nilai2);
akses.perkalian(nilai1,nilai2);
akses.pembagian(nilai1,nilai2);
}
public void pengurangan(int x,int y){
System.out.println(“”);
System.out.println(“\t\tAKSES DILUAR SCOPE”);
System.out.println(“\t\t******************”);
int kurang=x-y;
System.out.println(“\t\tNilai pengurangan : “+x+” – “+y+” = “+kurang);
}
public void perkalian(int x,int y){
int kali=x*y;
System.out.println(“\t\tNilai perkalian : “+x+” x “+y+” = “+kali);
}
public void pembagian(double x,double y){
double bagi=x/y;
System.out.println(“\t\tNilai pembagian : “+x+” : “+y+” = “+bagi);
System.out.println(“”);
}
}

 
Leave a comment

Posted by on May 4, 2011 in about me

 

Tags:

Leave a Reply

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

 
%d bloggers like this: