Introduction to Primitive shapes

A primitive shape is a basic geometric shape that cannot be broken down into any simpler geometric shapes. Examples of primitive shapes include points, lines, and circles. These shapes are the building blocks for more complex shapes and are the simplest forms of geometric objects.

The most common primitive shapes are:

  • Points
  • Lines
  • Circles
  • Triangles
  • Squares
  • Rectangles
  • Polygons

Create a Polygon class:

Properties:

  • height
  • width

Methods:

  • getArea()
  • getPerimeter()

Create a Rectangle class which inherits from Polygon:

Properties:

  • height
  • width

Methods:

  • getArea()
  • getPerimeter()

Create a Square class which inherits from Polygon:

Properties:

  • height

Methods:

  • getArea()
  • getPerimeter()

Create a Triangle class which inherits from Polygon. modify a method in a child class that it has inherited from the parent class:

Properties:

  • a
  • b
  • c

Methods:

  • getArea()
  • getPerimeter()

Create a Point class

Properties:

  • x
  • y

Methods:

  • distance_from_Xcoordinate()
  • distance_from_Ycoordinate()
  • getQuadrant()
  • on_Xcoordinate()
  • on_Ycoordinate()

coordinate

Create a Line class

Properties:

  • x1
  • y1
  • x2
  • y2

Methods:

  • get_length()

lenght

Cirlce

Properties:

  • r

Methods:

  • getArea()()
  • getLength()