Pipeline controller: plan 2 (hard +, error +50 %), backlog throttle, 2 trajectory workers, stop rules, summaries every 50; budget reserve
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
67
tasks_gen/train/G1015/spec.md
Normal file
67
tasks_gen/train/G1015/spec.md
Normal file
@@ -0,0 +1,67 @@
|
||||
# 1. Goal
|
||||
A vehicle recovery service charges a call-out fee for a breakdown tow. A dispatch
|
||||
program calls the calculation for each completed tow. The program needs the fee
|
||||
and one status code for each call.
|
||||
|
||||
# 2. Open questions
|
||||
None.
|
||||
|
||||
# 3. Context
|
||||
- Package $TMP is available.
|
||||
- The class is self-contained. No other object is necessary.
|
||||
|
||||
# 4. Contract
|
||||
- Create the class {{P}}TOWING_FEE in package $TMP.
|
||||
- The class is public and final. It has a public constructor without parameters.
|
||||
- The class has these public types:
|
||||
- TY_STATUS: character field, length 8.
|
||||
- TY_AMOUNT: integer.
|
||||
- TY_CLASS: character field, length 1.
|
||||
- TY_RESULT: structure with the components STATUS (type TY_STATUS) and FEE
|
||||
(type TY_AMOUNT).
|
||||
- The class has the public constant structure C_STATUS with the components OK,
|
||||
BAD_CLASS, BAD_DISTANCE and BAD_HOUR. The values are 'OK', 'CLASS',
|
||||
'DISTANCE' and 'HOUR'.
|
||||
- The class has exactly one public method:
|
||||
CALCULATE
|
||||
IMPORTING iv_vehicle_class TYPE ty_class
|
||||
iv_distance_km TYPE i
|
||||
iv_hour TYPE i
|
||||
iv_is_weekend TYPE abap_bool
|
||||
RETURNING VALUE(rs_result) TYPE ty_result.
|
||||
- Do not add other public methods.
|
||||
|
||||
# 5. Business rules
|
||||
The method CALCULATE applies the rules in this sequence.
|
||||
1. Check the input. Return the status of the first check that fails:
|
||||
1.1 The vehicle class must be 'S', 'M' or 'L'. Else return BAD_CLASS.
|
||||
1.2 The distance must be from 1 to 500 kilometres. Else return BAD_DISTANCE.
|
||||
1.3 The hour must be from 0 to 23. Else return BAD_HOUR.
|
||||
If a check fails, the fee is 0.
|
||||
2. The base fee comes from the vehicle class:
|
||||
S = 60 EUR, M = 90 EUR, L = 140 EUR.
|
||||
3. The distance charge: the first 10 kilometres are free. Each kilometre above
|
||||
10 kilometres costs 2 EUR.
|
||||
4. Add the base fee and the distance charge. The result is the subtotal.
|
||||
5. The night is the hour 22, the hour 23 and the hours 0 to 5. If the call is at
|
||||
night, calculate 25 percent of the subtotal. Round this night surcharge down
|
||||
to a full euro.
|
||||
6. If the call is on a weekend, calculate 15 percent of the subtotal. Round this
|
||||
weekend surcharge down to a full euro. The night surcharge and the weekend
|
||||
surcharge can apply together. Calculate both surcharges from the subtotal.
|
||||
7. Add the subtotal and all surcharges. The result is the total.
|
||||
8. If the total is below 80 EUR, the total is 80 EUR.
|
||||
9. Round the total up to a full 5 EUR. If the total is already a full 5 EUR, the
|
||||
total does not change.
|
||||
10. Return the status OK and the fee.
|
||||
|
||||
# 6. Constraints
|
||||
- Release target: ABAP Platform 2025 (SAP_BASIS 816).
|
||||
- Coding standards: Clean ABAP. Method length below 40 statements. No global
|
||||
variables. No comment that restates the code.
|
||||
- Out of scope: do not create 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.
|
||||
Reference in New Issue
Block a user