48 lines
2.1 KiB
Markdown
48 lines
2.1 KiB
Markdown
# 1. Goal
|
|
A municipal library charges a fee when a borrower returns a media item after
|
|
the due date. The returns desk calls one function module for each returned
|
|
item. The function module must have the same interface as the sample function
|
|
module, because the returns desk calls all fee modules in the same way.
|
|
|
|
# 2. Open questions
|
|
None.
|
|
|
|
# 3. Context
|
|
- Function group {{P}}FG_LIB exists in package $TMP.
|
|
- Function module {{P}}LIB_SAMPLE exists in this group. It is the sample fee
|
|
module. Its interface is the interface that all fee modules must use.
|
|
|
|
# 4. Contract
|
|
- Create the function module {{P}}LIB_FEE in function group {{P}}FG_LIB.
|
|
- Use exactly the interface of {{P}}LIB_SAMPLE: the same parameter names,
|
|
kinds, types, and exceptions.
|
|
- The parameters have this meaning:
|
|
- iv_media_type: the media type of the returned item.
|
|
- iv_days_late: the number of days between the due date and the return date.
|
|
- iv_value: the replacement value of the item in euro.
|
|
- ev_blocked: the borrower is blocked when this flag is true.
|
|
- cv_fee: the fee in euro. The caller can pass an initial value.
|
|
|
|
# 5. Business rules
|
|
1. If iv_days_late is less than 0, raise the exception INVALID_DAYS.
|
|
2. Set ev_blocked to false, except in rule 6.
|
|
3. Media type BOOK: the fee is iv_value * iv_days_late * 0.5 / 100. Round the
|
|
fee half up to 2 decimals. The maximum fee is 5.00.
|
|
4. Media type DVD: the fee is iv_value * iv_days_late * 1 / 100. Round the fee
|
|
half up to 2 decimals. The maximum fee is 12.00.
|
|
5. Media type MAG: the fee is 0.30 for each day late. There is no maximum.
|
|
6. Media type REF: set ev_blocked to true. Do not change cv_fee.
|
|
7. Any other media type: the fee is 0.
|
|
|
|
# 6. Constraints
|
|
- Release target: 7.02. Use only ABAP syntax that release 7.02 supports.
|
|
- Follow Clean ABAP. Keep every method below 40 statements.
|
|
- Out of scope: do not change {{P}}LIB_SAMPLE.
|
|
- Do not use application tables.
|
|
- Write ABAP Unit tests for the function module in a global test class.
|
|
|
|
# 7. Acceptance
|
|
- The function module {{P}}LIB_FEE is active and has no syntax error.
|
|
- The hidden tests pass.
|
|
- Your ABAP Unit tests pass.
|