Files
abap-llm/tasks_gen/eval/G0135/spec.md

1.9 KiB

1. Goal

A leisure centre sells swim tickets at its pool. A checkout program calls the class {{P}}POOL_FEE to get the fee of one ticket. The class works, but the code is hard to read and hard to maintain. Refactor the class. The behaviour stays the same.

2. Open questions

None.

3. Context

  • The class {{P}}POOL_FEE exists in package $TMP and is active.
  • The class is the only object that you change.
  • A checkout program calls the public method CALCULATE_FEE. The signature and the result of the method must not change.
  • The current implementation holds the business rules. Read it before you change it.

4. Contract

  • Refactor the class {{P}}POOL_FEE in package $TMP. Keep the name.
  • The class stays public and final. The constructor stays public and has no parameters.
  • Keep the public interface exactly as it is:
    • TYPES ty_ticket TYPE c LENGTH 1.
    • TYPES ty_amount TYPE p LENGTH 8 DECIMALS 2.
    • METHOD calculate_fee IMPORTING iv_ticket TYPE ty_ticket iv_minutes TYPE i iv_sauna TYPE abap_bool RETURNING VALUE(rv_fee) TYPE ty_amount.
  • Do not add other public methods, types or attributes.

5. Business rules

The behaviour of the class stays exactly the same. The rules are in the current implementation of the class. Read the legacy code. Keep every rule, including the rules for unusual input. Do not add a rule and do not remove a rule.

6. Constraints

  • Release target: SAP_BASIS 816.
  • Coding standards: Clean ABAP. Methods below 40 statements. Nesting depth at most 3. No magic numbers, use constants. No unused variables. No comment that restates the code. No global variables.
  • Out of scope: do not change any other object. Do not create new objects.

7. Acceptance

  • The class {{P}}POOL_FEE is active and has no syntax error.
  • The public interface of the class is unchanged.
  • The hidden tests pass.
  • Write your own ABAP Unit tests as local test classes in the class.