Files
2026-10-05 18:02:52 +02:00

51 lines
2.0 KiB
Markdown

# 1. Goal
Refactor the legacy class {{P}}PARKING_PRICER in package $TMP. A car park
operator uses the class to price a parking session. The class must keep its
public interface and must return the same fee as before for every input.
# 2. Open questions
None.
# 3. Context
- The class {{P}}PARKING_PRICER exists in package $TMP. It is active.
- The class is the contract object of this task. Refactor it in place. Keep the
class name, the package and the public interface.
- A checkout terminal calls the method calculate_fee for each parking session
and prints the returned fee.
- The legacy implementation contains the business rules. Read the legacy code
before you change it.
# 4. Contract
- Class {{P}}PARKING_PRICER in package $TMP. Public, final, create public.
- Public type ty_vehicle (c length 1).
- Public type ty_fee (p length 8, 2 decimals).
- Public constants:
c_vehicle_car = 'C', c_vehicle_motorcycle = 'M', c_vehicle_van = 'V'.
- Public method:
calculate_fee
IMPORTING iv_minutes TYPE i
iv_vehicle TYPE ty_vehicle
iv_lost_ticket TYPE abap_bool
RETURNING VALUE(rv_fee) TYPE ty_fee.
- Do not add other public methods. Do not change the signature.
# 5. Business rules
The behavior stays the same. The legacy implementation in package $TMP is the
only source of the rules. For every combination of iv_minutes, iv_vehicle and
iv_lost_ticket the refactored class must return the same fee as the legacy
class.
# 6. Constraints
- Release target: SAP_BASIS 816 (ABAP Platform 2025).
- Coding standards: Clean ABAP. Methods below 40 statements. No magic numbers.
No deep nesting. No duplicated code. No comment that restates the code. No
global variables.
- Out of scope: the public interface of {{P}}PARKING_PRICER. Do not rename,
remove or add public types, constants or methods.
# 7. Acceptance
- The class is active and has no syntax error.
- The hidden tests pass.
- Write your own ABAP Unit tests for the class.
- No ATC priority 1 or priority 2 finding.