Create a class named Triangle and Rectangle.
Create a subclass named Square inherited from Rectangle.
Create a subclass named Cube inherited from Square.
Create a subclass named Pyramid multiple inherited both from Triangle and Square.
Two dimensional classes (Triangle, Rectangle and Square) should have:
- its dimensions as attributes.(can be inherited from a superclass)
- methods which calculate its area and perimeter separately.
Three dimensional classes (
CubeandPyramid) should have: - its dimensions as attributes which are inherited from a superclass
- its extra dimensions if there is. (hint: maybe for
Pyramid) - methods which calculate its volume and surface area separately. (surface area is optional, you may not do this)