java-lessons

View on GitHub

Geometric Shapes

Description

There are different geometric shapes. All geometric shapes have a perimeter and an area. Some geometric shapes need the constant pi to calculate these values.

Tasks

  1. Implement an abstract class GeometricShape that defines the abstract functions to get the perimeter and the area and a static for pi.
  2. Implement the classes Square, Circle and Rectangle that extend the class GeometricShape.
  3. Implement constructors that contain the parameters needed to calculate the functions (like radius, length of sides…).
  4. Implement the functions for the different shapes.
  5. Write a “Main”-class ShapeTester that tests your implementation