THINK FIRST·CODE LATER

← All labs

Shape hierarchy: abstract class, polymorphism and an interface

Problem

Write an abstract Shape with area() and perimeter(), subclasses Circle, Rectangle and IsoscelesRightTriangle, and an interface Scalable implemented by two of them. Print all three shapes with one loop.

Write it here or in your IDE, then paste it. Compile and test it yourself before comparing. Your code stays in your browser — it is never sent to or stored on the server.