Programming Course in C# ¡Free!

Shapes

 Saturday, April 06, 2013 published by Exercises C#
Proposed exercise

Create a project and the corresponding classes for this classes diagram.




Output



Solution


class Shape
{
    protected Location c;

    public string ToString()
    {
        return "";
    }

    public double Area()
    {
        return 0.000;
    }

    public double Perimeter()
    {
        return 0.000;
    }
}

class Rectangle : Shape
{
    protected double side1, side2;
}

class Circle : Shape
{
    protected double radius;
}

class Location
{
    private double x, y;
}

class TestShape
{
    static void Main()
    {

    }
}