public class segitiga {
public int a;
public int b;
public int c;
public int t=4;
public double
Luas;
public int Kell;
public void
segitiga(double luas){
Luas=a*t/2;
}
public void
segitiga(float kell){
Kell=(a+b+c);
}
public void
segitiga (String sg){
System.out.println("Menampilkan Segitiga");
System.out.println("Tinggi :"+getT());
System.out.println("Luas Segitiga= "+getLuas());
System.out.println("Keliling Segitiga= "+getKell());
}
public double
getA() {
return a;
}
public void
setA(int a) {
this.a = a;
}
public double
getB() {
return b;
}
public void
setB(int b) {
this.b = b;
}
public double getC() {
return c;
}
public void setC(int
c) {
this.c = c;
}
public double getT() {
return t;
}
public void setT(int
t) {
this.t = t;
}
public double getLuas() {
Luas=a*t/2;
return Luas;
}
public void setLuas(double Luas) {
this.Luas =
Luas;
}
public double
getKell() {
Kell=(a+b+c);
return Kell;
}
public void
setKell(int Kell) {
this.Kell =
Kell;
}
}
public class Hasil_sgt {
public static
void main(String[] args) {
segitiga n = new
segitiga();
n.setA(Integer.parseInt(JOptionPane.showInputDialog(null,"Masukkan
sisi a ")));
System.out.println("Sisi a :" +n.getA());
n.setB(Integer.parseInt(JOptionPane.showInputDialog(null,"Masukkan
sisi b ")));
System.out.println("Sisi b :" +n.getB());
n.setC(Integer.parseInt(JOptionPane.showInputDialog(null,"Masukkan
sisi c ")));
System.out.println("Sisi c :" +n.getC());
n.getT();
System.out.println("Tinggi :" +n.getT());
n.getLuas();
System.out.println("Luas Segitiga :" +n.getLuas());
n.getKell();
System.out.println("Kelling Segitiga :" +n.getKell());
n.segitiga(n.getLuas());
n.segitiga(n.getKell());
n.segitiga(n.getT());
n.segitiga("");
Posted by 00.16 and have
0
komentar
, Published at
Tidak ada komentar:
Posting Komentar