double panjang = 4;
double lebar = 3;
double luas;
double kell;
public void keliling (){
kell = 2*(panjang*lebar);
System.out.println("kelilingnya adalah = "+kell);
}
public void luas(){
luas= panjang*lebar;
System.out.println("luasnya adalah= "+luas);
}
public void ket(){
System.out.println("panjang persegi panjang = "+panjang);
System.out.println("Lebar persegi panjang = "+lebar);
}
public double getpanjang(){
return panjang;
}
public void setpanjang( double temp ){
panjang = temp;}
public double getlebar(){
return lebar;
}
public void setlebar( double temp ){
lebar = temp;
}
public void sisi(){
System.out.println("panjang"+panjang);
}
public void sisi(double temp){
System.out.println("lebar"+lebar);
}
public void sisi(double a, double b ){
System.out.println("luas"+luas);
System.out.println("keliling"+kell);
}
public void algo2(){
System.out.println("persegi");
}
public void algo2(String temp){
System.out.println("persegi panjang");
}
public void algo2(String a, String b){
System.out.println("kubus");
}
public static void main(String[] args) {
Algo2 a = new Algo2();
a.setlebar(10);
a.setpanjang(10);
a.ket();
a.luas();
a.keliling();
a.sisi();
a.sisi(0);
a.sisi(1, 2);
a.algo2();
a.algo2(null);
a.algo2(null, null);
}
}
Posted by 01.51 and have
0
komentar
, Published at
Tidak ada komentar:
Posting Komentar