eolymp
bolt
Try our new interface for solving problems
Problems

Java Inheritance Shape

Java Inheritance Shape

Implement a class Shape.

Implement classes Circle, Rectangle, Triangle that extend Shape.

class Shape
{
  private String shapeName; // private variable
  Shape(String name) // Constructor
  public String getShapeName() // return name of the shape
  public String toString() // Print the variable
}

class Circle extends Shape
{
  Circle() // Constructor 
}

class Rectangle extends Shape
{
  Rectangle() // Constructor 
}

class Triangle extends Shape
{
  Triangle() // Constructor 
}

Input

Each line contains one of the next words:

  • Circle
  • Rectangle
  • Triangle

Output

For each word create a corresponding class and print the name of the shape.

Time limit 1 second
Memory limit 128 MiB
Input example #1
Circle
Rectangle
Triangle
Rectangle
Output example #1
Circle
Rectangle
Triangle
Rectangle
Author Michael Medvedev