To introduce the state pattern I will use three refactorings. First I’ll move the type code behavior into the state pattern with Replace Type Code with State/Strategy (227). Then I can use Move Method (142) to move the switch statement into the price class. Finally I’ll use Replace Conditional with Polymorphism (255) to eliminate the switch statement.

