Here are the classes involved in the Cake example:

public abstract class Cake {
    private String flavor;

    public Cake(String Flavor) {
        flavor = Flavor;
    }
    
    public String getFlavor() {
        return flavor;
    }
    
    public double price() {
        return 3 * this.area();  //3 times area of cake
    }
    
    public String description() {
        return this.shape() + " " + flavor + " cake";
    }
    
    abstract public double area();
    abstract public String shape();
}

public class RoundCake extends Cake {
    private int radius;
    
    public RoundCake(String Flavor, int Radius) {
        super(Flavor);
        radius = Radius;
    }
    
    public double area() {
        return 3.14 * radius * radius;
    }
    
    public String shape() {
        return "round";
    }
}

public class RectangleCake extends Cake {
    int length;
    int width;
    
    RectangleCake(String Flavor, int Length, int Width) {
        super(Flavor);
        length = Length;
        width = Width;
    }
    
    public double area() {
        return length * width;
    }
    
    public String shape() {
        return "rectangular";
    }
}

public class SquareCake extends Cake {
    private int length;
    
    public SquareCake(String Flavor, int Length) {
        super(Flavor);
        length = Length;
    }
    
    public double area() {
        return length * length;
    }
    
    public String shape() {
        return "square";
    }

}