abstract class Form { protected String farge; protected Form(String farge) { this.farge = farge; } public String hentFarge() { return farge; } } class Sirkel extends Form { private int radius; public Sirkel(String farge, int radius) { super(farge); this.radius = radius; } public double areal() { return 3.14*Math.pow(radius, 2); //Kan ogsaa skrive 3.14*radius*radius } } class Rektangel extends Form { int lengde, bredde; public Rektangel(String farge, int lengde, int bredde) { super(farge); this.lengde = lengde; this.bredde = bredde; } public int areal() { return lengde*bredde; } } class Kvadrat extends Rektangel { public Kvadrat(String farge, int lengde) { super(farge, lengde, lengde); } }