PBO A - TUGAS CLASS
Syntax untuk class main nya :
public class main
{
public static void main(String args[]){
triangle segi3; segi3 = new triangle();
bujur busangkar; busangkar = new bujur();
persegip rectangle; rectangle = new persegip();
jajargenjang jajar; jajar = new jajargenjang();
belah ketupat; ketupat = new belah();
segi3.height = 10;
segi3.side = 5;
double area = segi3.area();
double keliling = segi3.circumference();
System.out.print("Luas segitiga = "+area+" keliling = "+keliling);
busangkar.sisi = 5;
double luasb = busangkar.luas();
double kelilingb = busangkar.kelilink();
System.out.print("\nLuas bujur sangkar = "+luasb+" keliling = "+kelilingb);
rectangle.l = 5;
rectangle.p = 10;
int luaspp = rectangle.luas();
int kelilingpp = rectangle.keliling();
System.out.print("\nLuas persegi panjang = "+luaspp+" keliling = "+kelilingpp);
jajar.alas = 10;
jajar.tinggi = 5;
jajar.miring = 4;
int luasj = jajar.luas();
int kelilingj = jajar.keliling();
System.out.print("\nLuas jajar genjang = "+luasj+" keliling = "+kelilingj);
ketupat.d1 = 5;
ketupat.d2 = 8;
ketupat.sisi = 13;
double luasketupat = ketupat.luas();
int kelilingketupat = ketupat.keliling();
System.out.print("\nLuas belah ketupat = "+luasketupat+" keliling = "+kelilingketupat);
}
}
Komentar
Posting Komentar