Let the object answerintermediate
A switch on a type must be edited every time a type is added, and there is always more than one of them; asking the object instead means a type invented tomorrow works in code written today.
A switch that must be edited for every new type. Let the objects answer instead.
totalArea works for the three known shapes and for one it has never seen.
Published in full, before you start — every point is one of these and there is nothing else. Each one runs your code; it is not a search for keywords.
A switch on a type must be edited every time a type is added, and there is always more than one of them; asking the object instead means a type invented tomorrow works in code written today.