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.
The leap-year rule is written out twice inside one method. Before anything can vary, it needs a name and one home.
One IsLeap method, the rule written once, both call sites using it, and the century case traced correctly.
Published in full, before you start — every point is one of these and there is nothing else.
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 date, a price, a flag — each is stored as numbers, and integer division and remainder are how you take a number apart; money needs decimal because binary floating point cannot hold 0.10 exactly.