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:
59
tasks_gen/train/G1023/spec.md
Normal file
59
tasks_gen/train/G1023/spec.md
Normal file
@@ -0,0 +1,59 @@
|
||||
# 1. Goal
|
||||
A ride-sharing service splits the cost of a shared ride between the passengers.
|
||||
The booking program calls the calculation after each completed ride. The program
|
||||
needs the total cost of the ride and the share of each passenger.
|
||||
|
||||
# 2. Open questions
|
||||
None.
|
||||
|
||||
# 3. Context
|
||||
- A ride has one driver and one or more passengers. The driver is not a
|
||||
passenger and pays nothing.
|
||||
- The service charges a base fee, a distance fee and a detour fee.
|
||||
- The booking program knows the distance of the ride in whole kilometres and
|
||||
the number of passengers of the ride.
|
||||
|
||||
# 4. Contract
|
||||
- Create the class {{P}}RIDESHARE_SPLIT in package $TMP.
|
||||
- The class is public and final. It has a public constructor without parameters.
|
||||
- The class has these public types:
|
||||
- TY_DISTANCE: a whole number of kilometres.
|
||||
- TY_AMOUNT: a packed number with 2 decimals. The currency is euro.
|
||||
- The class has these public methods. Do not add other public methods.
|
||||
- CALCULATE_TOTAL
|
||||
IMPORTING iv_distance_km TYPE ty_distance
|
||||
iv_passengers TYPE i
|
||||
RETURNING VALUE(rv_total) TYPE ty_amount
|
||||
- CALCULATE_SHARE
|
||||
IMPORTING iv_distance_km TYPE ty_distance
|
||||
iv_passengers TYPE i
|
||||
RETURNING VALUE(rv_share) TYPE ty_amount
|
||||
|
||||
# 5. Business rules
|
||||
Apply the rules in this sequence.
|
||||
1. The number of passengers is the number of persons who share the ride.
|
||||
2. If the number of passengers is less than 1, the total cost is 0.00 and the
|
||||
share is 0.00. Rules 3 to 7 do not apply.
|
||||
3. A distance below 0 counts as 0 kilometres.
|
||||
4. The total cost of the ride is the sum of:
|
||||
- a base fee of 3.00,
|
||||
- a distance fee of 0.40 for each kilometre,
|
||||
- a detour fee of 1.20 for each passenger after the first passenger.
|
||||
5. The share of a passenger is the total cost divided by the number of
|
||||
passengers.
|
||||
6. Round the share to 2 decimals. Round a half away from zero (for example,
|
||||
2.345 becomes 2.35).
|
||||
7. The minimum share is 1.50. If the rounded share is below 1.50, the share is
|
||||
1.50. The minimum share does not change the total cost.
|
||||
|
||||
# 6. Constraints
|
||||
- Release target: 8.16 (SAP_BASIS 816).
|
||||
- Coding standards: Clean ABAP. Methods below 40 statements. No global
|
||||
variables. No comment that restates the code.
|
||||
- Out of scope: no database table, no CDS view, no report, no function module,
|
||||
no interface.
|
||||
|
||||
# 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