public abstract class Figure {
    // Una clase abstracta no puede ser instanciada
    // Una clase abstracta puede tener algun metodo abstracto
    protected final String type;
    Figure(String type) {
        this.type = type;
    }
    // Los metodos abstractos se declaran pero no se implementan
    // Todas las clases que extend Figure tienen que implementar todos
    // los metodos abstractos
    public abstract double calculateArea();
    public abstract double calculatePerimeter();
    @Override
    public String toString() {
        return this.type;
    }
}
/*
https://docs.oracle.com/javase/tutorial/java/IandI/abstract.html
ABSTRACT CLASSES COMPARED TO INTERFACES
Abstract classes are similar to interfaces. You cannot instantiate them, and
they may contain a mix of methods declared with or without an implementation.
However, with abstract classes, you can declare fields that are not static and
final, and define public, protected, and private concrete methods. With
interfaces, all fields are automatically public, static, and final, and all
methods that you declare or define (as default methods) are public. In
addition, you can extend only one class, whether or not it is abstract, whereas
you can implement any number of interfaces.
*/
