We're sorry but this app doesn't work properly without JavaScript enabled. Please enable it to continue.

This lesson's interactive features are locked, please to keep using them

Inheritance Practice

You discovered that to properly calculate army formations in the game, you needed to be able to get the area and perimeter of squares and rectangles of various sizes.

A rectangle's perimeter is the total distance around its four sides: two lengths plus two widths, or 2 * (length + width).

Assignment

Complete the Rectangle and Square classes. All squares are rectangles, but not all rectangles are squares.

Because Square inherits Rectangle's methods, it should only need to implement __init__.