Exercise: Modeling Classes
OOPs exercise in JavaScript to implement a class for shapes and rectangles.
We'll cover the following
Task
An architect is designing a 3D model for a new building. Given the many shapes that make up a building, he wants to calculate the area of his custom shapes. For now, he wants you to create a class or constructor function called Rectangle
which can both calculate the area of his walls and also tell if a wall is squarish. Because there are lots of shapes, you will also be creating a class or constructor function for all shapes named Shape
. This will store properties for all shapes. Classes like Rectangle
should be derived from the Shape
class.
Get hands-on with 1400+ tech skills courses.