public class Sirkel extends Form { private int radius; public Sirkel(String farge, int radius) { super(farge); this.radius = radius; } @Override public String hentFormelAreal() { return "PI*r^2"; } @Override public int areal() { return (int) Math.round( Math.PI*Math.pow(radius, 2) ); } @Override public int omkrets() { return (int)Math.round(2*Math.PI*radius); } public int diameter() { return radius*2; } @Override public void skrivType() { System.out.println("Sirkel"); } public boolean equals(Object obj) { if (obj instanceof Sirkel) { if (((Sirkel) obj).hentFarge() == hentFarge() && ((Sirkel) obj).radius == radius) { return true; } } return false; } @Override public String toString() { return "Sirkel : "+hentFarge(); } // return (int) Math.round( Math.PI*Math.pow(radius, 2) ); //return(int)Math.round(2*Math.PI*radius); // }