Replace Conditional Logic With Strategy

Problem:

Conditional logic in a method controls which of several variants of a calculation are executed.

Solution:

Create a Strategy for each variant and make the method delegate the calculation to a Strategy instance.