# 1. Goal A chimney sweep company calculates the fee of a sweep visit. A dispatcher program calls the class {{P}}SWEEP_PRICER before it confirms an appointment. The class works, but the code is hard to read and hard to change. Refactor the class. The behavior stays the same. # 2. Open questions None. # 3. Context - The class {{P}}SWEEP_PRICER exists in package $TMP. It is active. - The class is public and final. It has one public method, CALCULATE. - The method CALCULATE has the importing parameters iv_flues (TYPE i), iv_building (TYPE ty_building), iv_soot (TYPE i) and iv_express (TYPE abap_bool). It has the returning parameter rv_fee (TYPE ty_fee). - ty_building and ty_fee are public types of the class. ty_building is CHAR 1. ty_fee is a packed number with 8 characters and 2 decimal places. - The legacy code contains the complete business logic. Read the legacy code. # 4. Contract - Refactor the class {{P}}SWEEP_PRICER in package $TMP. - The class stays public and final. - The public method CALCULATE keeps its name, its parameters and the types of the parameters. - Do not add other public methods or public attributes. # 5. Business rules - The legacy code contains all the business rules. - The behavior of the method CALCULATE stays the same for every input. - Do not change any result of the method CALCULATE. # 6. Constraints - Release target: SAP_BASIS 816 (ABAP Platform 2025). - Coding standards: Clean ABAP. A method has less than 40 statements. No deep nesting. No magic numbers, use constants. Use meaningful names. No comment that restates the code. No global variables. - Out of scope: do not change the public interface of the class. # 7. Acceptance - The class is active and has no syntax error. - The hidden tests pass. They check the unchanged behavior. - Write your own ABAP Unit tests for the class.