Files
abap-llm/tasks_gen/train/G1073/spec.md
2026-10-05 18:02:52 +02:00

58 lines
2.7 KiB
Markdown

# 1. Goal
Summarise the parking sessions of the car parks of a car park operator. The
operations team calls the class for each day. The class returns one row for each
car park with the number of sessions, the total parking time and the total fee.
# 2. Open questions
None.
# 3. Context
- The interface {{P}}IF_PARK_EVAL exists in package $TMP. It is active.
- The interface has the type TY_PARK_ID (CHAR 4), the type TY_TARIFF (CHAR 1),
the structure TY_SESSION with the components PARK_ID, TARIFF and DURATION_MIN,
the table type TT_SESSION (a standard table of TY_SESSION with an empty key),
the structure TY_SUMMARY with the components PARK_ID, SESSION_CNT, TOTAL_MIN
and TOTAL_FEE, the table type TT_SUMMARY (a standard table of TY_SUMMARY with
an empty key), and one method:
SUMMARIZE IMPORTING it_session TYPE tt_session
RETURNING VALUE(rt_summary) TYPE tt_summary.
- DURATION_MIN is the parking time of one session in minutes.
- The operations program collects the sessions of one day and passes them to the
class.
# 4. Contract
- Create the class {{P}}PARKING_EVAL in package $TMP.
- The class is public and final. It has a public constructor without parameters.
- The class implements {{P}}IF_PARK_EVAL.
- Do not add other public methods.
# 5. Business rules
1. A session is valid when its tariff is A, B or C and its duration is greater
than 0 minutes. Ignore an invalid session completely. Do not count it, do not
add its duration and do not add a fee.
2. The first 30 minutes of a valid session are free.
3. The operator charges each started hour after the first 30 minutes. The first
started hour covers the minutes 31 to 90, the second started hour covers the
minutes 91 to 150, and so on.
4. The price of one started hour depends on the tariff:
A = 2.00 EUR, B = 3.50 EUR, C = 5.00 EUR.
5. The fee of one session is at most 20.00 EUR.
6. The result has one row for each car park with at least one valid session.
7. SESSION_CNT is the number of valid sessions of the car park.
8. TOTAL_MIN is the sum of the durations of the valid sessions of the car park.
9. TOTAL_FEE is the sum of the fees of the valid sessions of the car park.
10. Sort the result in ascending order of PARK_ID.
11. An empty input gives an empty result.
# 6. Constraints
- Release target: SAP_BASIS 816 (ABAP Platform 2025).
- Coding standards: Clean ABAP. Method length below 40 statements. No global
variables. No comment that restates the code.
- Out of scope: do not change {{P}}IF_PARK_EVAL. Do not create database tables,
CDS views or other objects.
# 7. Acceptance
- The class is active and has no syntax error.
- The hidden tests pass.
- Write your own ABAP Unit tests for the class.