Stage 2 summary at 50 accepted trajectories

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
Kral
2026-10-05 18:02:52 +02:00
parent 332fb4601d
commit 5bcd1bf9cd
1230 changed files with 77563 additions and 33 deletions

View File

@@ -0,0 +1,77 @@
# 1. Goal
A tyre shop fits tyres to a vehicle. Before the mechanic starts a job, the
shop checks the fitting order against the vehicle. The shop needs one reason
for each rejected order.
# 2. Open questions
None.
# 3. Context
- The interface {{P}}IF_TYRE_ORDER exists in package $TMP. It is active.
- The interface has two types:
- TY_VEHICLE with the components WIDTH_MM, PROFILE_PCT, RIM_INCH,
LOAD_INDEX and SPEED_KMH. All components have the type i.
- TY_ORDER with the components WIDTH_MM, PROFILE_PCT, RIM_INCH, LOAD_INDEX,
SPEED_KMH and QTY. All components have the type i.
- WIDTH_MM is the tyre width in millimetres. PROFILE_PCT is the aspect ratio
in percent. RIM_INCH is the rim diameter in inches. LOAD_INDEX is the load
index of the tyre. SPEED_KMH is the maximum speed in kilometres per hour.
QTY is the number of tyres of the order.
# 4. Contract
Create these objects in package $TMP.
- Class {{P}}TYRE_CHECKER. It is public and final.
- Public constructor:
CONSTRUCTOR IMPORTING is_vehicle TYPE {{P}}IF_TYRE_ORDER=>TY_VEHICLE.
- Public method:
CHECK_ORDER IMPORTING is_order TYPE {{P}}IF_TYRE_ORDER=>TY_ORDER
RAISING {{P}}CX_TYRE_QTY {{P}}CX_TYRE_SIZE {{P}}CX_TYRE_LOAD
{{P}}CX_TYRE_SPEED.
- Exception class {{P}}CX_TYRE_ERROR. It inherits from CX_STATIC_CHECK.
- Public read-only attribute MV_TEXT TYPE string.
- Public constructor:
CONSTRUCTOR IMPORTING iv_text TYPE string.
- Exception class {{P}}CX_TYRE_QTY. It inherits from {{P}}CX_TYRE_ERROR.
- Public constructor without parameters.
- Exception class {{P}}CX_TYRE_SIZE. It inherits from {{P}}CX_TYRE_ERROR.
- Public constructor without parameters.
- Exception class {{P}}CX_TYRE_LOAD. It inherits from {{P}}CX_TYRE_ERROR.
- Public constructor without parameters.
- Exception class {{P}}CX_TYRE_SPEED. It inherits from {{P}}CX_TYRE_ERROR.
- Public constructor without parameters.
Do not add other public methods to {{P}}TYRE_CHECKER.
# 5. Business rules
CHECK_ORDER compares the order with the vehicle of the constructor. Check the
rules in this sequence. Raise the exception of the first rule that fails. Do
not check a rule after a rule has failed.
1. QTY must be greater than or equal to 1 and less than or equal to 4. If not,
raise {{P}}CX_TYRE_QTY.
2. WIDTH_MM, PROFILE_PCT and RIM_INCH of the order must be equal to the
WIDTH_MM, PROFILE_PCT and RIM_INCH of the vehicle. If not, raise
{{P}}CX_TYRE_SIZE.
3. LOAD_INDEX of the order must be greater than or equal to the LOAD_INDEX of
the vehicle. If not, raise {{P}}CX_TYRE_LOAD.
4. SPEED_KMH of the order must be greater than or equal to the SPEED_KMH of
the vehicle. If not, raise {{P}}CX_TYRE_SPEED.
5. If no rule fails, the method returns without an exception.
Each exception class sets MV_TEXT in its own constructor:
- {{P}}CX_TYRE_QTY: 'Quantity must be between 1 and 4'
- {{P}}CX_TYRE_SIZE: 'Tyre size does not match the vehicle'
- {{P}}CX_TYRE_LOAD: 'Load index is too low'
- {{P}}CX_TYRE_SPEED: 'Speed rating is too low'
# 6. Constraints
- Release target: 8.16.
- 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_TYRE_ORDER.
# 7. Acceptance
- All objects are active and have no syntax error.
- The hidden tests pass.
- Write your own ABAP Unit tests for the class.