SHARE2 niii... ayo silahkan di copass!!
class oopbangundatar
{
int p;
int l;
int t;
int a;
int s;
int si;
int d1;
int d2;
public int luaspersegi(int s, int si)
{
int c=s*si;
return c;
}
public int kelilingP(int s)
{
int c =s*4;
return c;
}
public int luassegitiga(int a, int t)
{
int c= (a*t)/2;
return c;
}
public int luaspersegipj(int p, int l)
{
int c= p*l;
return c;
}
public int kelilingpj(int p, int l)
{
int c= p*2+l*2;
return c;
}
public int luaslayang2(int d1, int d2)
{
int c= d1*d2/2;
return c;
}
}
class ProgramUtama{
public static void main (String[]args){
int x=21;
int y=7;
oopbangundatar AOOP = new oopbangundatar();
System.out.println("luas persegi=" + AOOP.luaspersegi (y,y));
System.out.println("keliling Persegi=" + AOOP.kelilingP (x));
System.out.println("luas segitiga=" + AOOP.luassegitiga (x,y));
System.out.println("luas persegi panjang=" + AOOP.luaspersegipj (x,y));
System.out.println("keliling persegi panjang=" + AOOP.kelilingpj (x,y));
System.out.println("luas layang-layang=" + AOOP.luaslayang2 (x,y));
}
}
0 comments:
Post a Comment