68 lines
3.2 KiB
Markdown
68 lines
3.2 KiB
Markdown
# 1. Goal
|
|
A fireworks display company plans displays for its clients. The order desk calls
|
|
one contract for the check of a display plan and for the fee of the display.
|
|
Create the interface that carries this contract.
|
|
|
|
# 2. Open questions
|
|
None.
|
|
|
|
# 3. Context
|
|
- The order desk of the fireworks display company receives one display plan for
|
|
each order. A plan has the calibre of the shells in millimetres, the zone of the
|
|
firing site, the wind speed in kilometres per hour, the start hour, the distance
|
|
to the crowd in metres and the duration of the display in minutes.
|
|
- The desk checks the plan before it confirms the order. The check stops at the
|
|
first rule that fails and returns one reason code.
|
|
- The desk calculates the fee of the display in euro after the check.
|
|
- The interface {{P}}IF_PYRO_ORDER does not exist yet. Create it in package
|
|
$TMP. The interface is the only object that the order desk needs.
|
|
|
|
# 4. Contract
|
|
- Create the interface {{P}}IF_PYRO_ORDER in package $TMP.
|
|
- The interface has the types TY_REASON, TY_ZONE, TY_AMOUNT and TY_ORDER.
|
|
- The interface has the constant structures C_REASON, C_LIMIT and C_DISTANCE.
|
|
- The interface has the methods CHECK_ORDER and CALC_FEE.
|
|
- The interface has no other types, constants or methods.
|
|
|
|
# 5. Business rules
|
|
1. TY_REASON is a character type of length 12. It holds the reason code of the
|
|
check.
|
|
2. TY_ZONE is a character type of length 1. It holds the zone of the firing
|
|
site.
|
|
3. TY_AMOUNT is a packed type of length 8 with 2 decimal places. It holds an
|
|
amount in euro.
|
|
4. TY_ORDER is a structure with exactly these six components, in this sequence:
|
|
CALIBRE_MM of type i, ZONE_CODE of type TY_ZONE, WIND_KMH of type i,
|
|
START_HOUR of type i, CROWD_M of type i and DURATION_MIN of type i.
|
|
5. C_REASON is a constant structure with exactly six components of type
|
|
TY_REASON:
|
|
OK = 'OK' for an accepted plan,
|
|
CALIBRE = 'CALIBRE' for a calibre that the company does not use,
|
|
ZONE = 'ZONE' for a zone that is not A, B or C,
|
|
WIND = 'WIND' for a wind that is stronger than the wind limit,
|
|
TIME = 'TIME' for a start hour outside the start window,
|
|
DISTANCE = 'DISTANCE' for a crowd distance below the safety distance.
|
|
6. C_LIMIT is a constant structure with exactly five components of type i:
|
|
MAX_WIND_KMH = 30, MIN_START_HOUR = 18, MAX_START_HOUR = 23,
|
|
FREE_MINUTES = 10 and MAX_FEE_EURO = 5000.
|
|
7. C_DISTANCE is a constant structure with exactly five components of type i:
|
|
CALIBRE_50 = 30, CALIBRE_75 = 45, CALIBRE_100 = 60, CALIBRE_150 = 90 and
|
|
CALIBRE_200 = 120. A component holds the safety distance in metres for the
|
|
calibre of the same name in millimetres. The company uses only these five
|
|
calibres.
|
|
8. CHECK_ORDER has the importing parameter IS_ORDER of type TY_ORDER and the
|
|
returning parameter RV_REASON of type TY_REASON.
|
|
9. CALC_FEE has the importing parameter IS_ORDER of type TY_ORDER and the
|
|
returning parameter RV_FEE of type TY_AMOUNT.
|
|
|
|
# 6. Constraints
|
|
- Release target: 8.16.
|
|
- Coding standards: Clean ABAP. Upper case for the names of the types, the
|
|
constants and the methods. No comment that restates the code.
|
|
- Out of scope: do not create other objects in package $TMP.
|
|
|
|
# 7. Acceptance
|
|
- The interface is active and has no syntax error.
|
|
- The hidden tests pass.
|
|
- Write your own ABAP Unit tests for the interface.
|