Solution Review: Implement Area and Perimeter Methods
This lesson discusses how to calculate the area and perimeter of a rectangle.
We'll cover the following
Solution:
The area()
and perimeter()
methods are written in lines 17-21. They simply take the values of width()
and height()
and perform the following calculations on them:
This is shown in the code below:
Get hands-on with 1400+ tech skills courses.