public class Trojkat extends Figura { private double bok_a = 0; private double bok_b = 0; private double bok_c = 0; Trojkat(String kolor, double bok_a, double bok_b, double bok_c) { this.kolor = kolor; this.bok_a = bok_a; this.bok_b = bok_b; this.bok_c = bok_c; } public String getKsztalt() { return Trojkat.class.getName(); } public double getPowierzchnia() { // wzor herona double p = this.getObwod() / 2; return Math.sqrt(p * (p - this.bok_a) * (p - this.bok_b) * (p - this.bok_c)); } public double getObwod() { return this.bok_a + this.bok_b + this.bok_c; } }