public class segitiga {
public int a;
public int b;
public int c;
public int t=4;
public double Luas;
public double Kell;
String d;
public segitiga(int a,int b, int c){
this.a=a;
this.b=b;
this.c=c;
}
public segitiga(String d){
this.d=d;
System.out.println("Mencari
"+d+" Segitiga ");
}
public segitiga(double
luas,double kell){
this.Luas=luas;
this.Kell=kell;
}
public void Hasil (){
Luas= a*t/2;
System.out.println("Luas
Segitiga :"+Luas);
}
public void Kell(){
Kell=a+b+c;
System.out.println("Keliling
Segitiga :"+Kell);
}
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 a = new
segitiga(Integer.parseInt(JOptionPane.showInputDialog(null,"Masukkan
sisi a
")),Integer.parseInt(JOptionPane.showInputDialog(null,"Masukkan
sisi b
")),Integer.parseInt(JOptionPane.showInputDialog(null,"Masukkan
sisi c ")));
System.out.println(""+a.getA());
System.out.println(""+a.getB());
System.out.println(""+a.getC());
segitiga b = new segitiga("Luas
dan Keliling ");
a.Hasil();
a.Kell();
}
}
Posted by 21.16 and have
0
komentar
, Published at
Tidak ada komentar:
Posting Komentar