/******************************************************************************

                              Online C++ Compiler.
               Code, Compile, Run and Debug C++ program online.
Write your code in this editor and press "Run" button to compile and execute it.

*******************************************************************************/

#include <iostream>
#include <string>
#include <math.h>

class Circulo
{
    private:
    
    double cx,
           cy,
           radio;
    
    public:
    
    Circulo(double x, double y, double r)
    {
        cx = x;
        cy = y;
        radio = r;
    }
    
    void setRadio(double r)
    {
        radio = r;
    }
    
    double getPerimeter()
    {
        return 2 * 3.1416 * radio; //perimetro = 2 * PI * radio
    }
    
    double getArea()
    {
        return 3.1416 * radio * radio; //area = PI * radio ^ 2;
        
    }
        
    void printStatus()
    {
        std::cout << "Circulo:\ncentro en : (" + std::to_string(cx) +
                     "," + std::to_string(cy) + ")\n" +
                     "radio : " + std::to_string(radio) + "\n"
                     "perimetro : " + std::to_string(getPerimeter()) + "\n" +
                     "area : " + std::to_string(getArea()) + "\n";
    }
};

class Rectangulo
{
    private:
    
    double xSupIzq,
           ySupIzq,
           xInfDer,
           yInfDer;
    
    public:
    
    Rectangulo(double x1, double y1, double x2, double y2)
    {
        xSupIzq = x1;
        ySupIzq = y1;
        xInfDer = x2;
        yInfDer = y2;
    }
    
    void setCoordinates(double x1, double y1, double x2, double y2)
    {
        xSupIzq = x1;
        ySupIzq = y1;
        xInfDer = x2;
        yInfDer = y2;
    }
        
    double getPerimeter()
    {
        //perimetro = suma de longitud de lados horizontales + lados verticales
        return 2 * (xInfDer - xSupIzq) + 2 * (ySupIzq - yInfDer); 
    }
    
    double getArea()
    {
        //area = longitud horizontal * longitud vertical
        return  (xInfDer - xSupIzq) * (ySupIzq - yInfDer); 
    }
    
    void printStatus()
    {
        std::cout << "Rectangulo:\n"
                     "esquina superior izquierda : (" + std::to_string(xSupIzq) +
                                                   ", " + std::to_string(ySupIzq) +
                                                   ")\n" +
                     "esquina inferior derecha   : (" + std::to_string(xInfDer) +
                                                   ", " + std::to_string(yInfDer) +
                                                   ")\n" +
                     "perimetro : " + std::to_string(getPerimeter()) + "\n" +
                     "area : " + std::to_string(getArea()) + "\n";                     
    }
    
};


int main()
{
    Circulo circulo1(20, 30, 10);
    circulo1.printStatus();
    circulo1.setRadio(5);
    circulo1.printStatus();
    
    Rectangulo rectangulo1(10, 90, 60, 20);
    rectangulo1.printStatus();
    rectangulo1.setCoordinates(50, 80, 60, 30);
    rectangulo1.printStatus();

    return 0;
}
