
public class Tester
{
    public static void main(String[] args){
       Shape s = new Rectangle(4, 5);
       Shape s2 = new Square(4);
       Square s3 = new Square(3);
       Rectangle r1 = new Square(2);
       Rectangle r2 = new Rectangle(3, 4);
       showShape( r2 );
       showShape( s3 );
       Circle c1 = new Circle(5);
       showShape( c1 );
       Shape[] sList = {s, s2, s3, r1, r2, c1};
       System.out.println( totalArea(sList) );
    }
    
    public static void showShape(Shape s){
        System.out.println( s.toString() );
        System.out.println( "Area: " + s.getArea() );
        System.out.println( "Perimeter: " + s.getPerimeter() );
    }
    
    public static double totalArea(Shape[] data){
        double total = 0.0;
        for(int i = 0; i < data.length; i++)
            total += data[i].getArea();
        return total;
    }
    
    
    
    
    
    
    
    
    
    
    
    
    
}
