Skip to main content

Checkpoint: shape dispatch

Challenge on lesson: Checkpoint: shape dispatch

CHALLENGE
Difficulty: intermediate+25 XP

Complete int totalArea(Shape[] shapes): sum every shape's area() via dispatch and round DOWN to an int. Square chains through Rect. One loop, one accumulator, zero instanceof — dispatch does the branching.

Back to lesson: Checkpoint: shape dispatch