class Trapezoid : public Shape
{
private:
double top;
double bottom;
double height;
public:
Trapezoid(double t, double b, double h)
{
top = t;
bottom = b;
height = h;
}
double Area()
{
return (top + bottom) * height / 2;
}
};
#define PI 3.1415926
class Circle : public Shape
{
private:
double r;
public:
Circle(double r)
{
this->r = r;
}
double Area()
{
return PI * r * r;
}
};
class Triangle : public Shape
{
private:
double bottom;
double height;
public:
Triangle(double b, double h)
{
bottom = b;
height = h;
}
double Area()
{
return bottom * height / 2;
}
};