Я бы не советовал использовать библиотеку для таких вещей. Просто найдите формулы для каждого и напишите одну строку кода, которая требуется для каждого.
Походит на чье-то классическое первое объектно-ориентированное задание:
package geometry;
public interface Shape
{
double perimeter();
double area();
}
class Rectangle implements Shape
{
private double width;
private double height;
Rectangle(double w, double h)
{
this.width = w;
this.height = h;
}
public double perimeter()
{
return 2.0*(this.width + this.height);
}
public double area()
{
return this.width*this.height;
}
}
// You get the idea - same for Triangle, Circle, Square with formula changes.