2.0 KiB
2.0 KiB
1. Goal
A scaffolding company hires out scaffold parts to building sites. A quotation program calls the fee calculation for each hire order before it prints the quotation. The program needs the final fee and the long-hire discount of the hire order.
2. Open questions
None.
3. Context
- The interface {{P}}IF_HIRE_FEE exists in package $TMP. It is active.
- The interface has the type TY_AMOUNT (packed, length 8, 2 decimals) and the structure type TY_RESULT with the components FEE and DISCOUNT. Both components have the type TY_AMOUNT.
- The interface has one method: CALCULATE_FEE IMPORTING iv_days TYPE i iv_parts TYPE i iv_express TYPE abap_bool RETURNING VALUE(rs_result) TYPE ty_result.
4. Contract
- Create the class {{P}}SCAFFOLD_FEE in package $TMP.
- The class is public, final, and has a public constructor without parameters.
- The class implements {{P}}IF_HIRE_FEE.
- Do not add other public methods.
5. Business rules
- The daily rate of one scaffold part is 4.20 EUR.
- The base fee is IV_DAYS multiplied by IV_PARTS multiplied by the daily rate.
- If IV_EXPRESS is true, the express surcharge is 12 percent of the base fee. Round the express surcharge up to the next full cent.
- If IV_DAYS is greater than 30, the long-hire discount is 6 percent of the base fee.
- The final fee is the base fee plus the express surcharge minus the long-hire discount.
- The result contains the final fee in the component FEE and the long-hire discount in the component DISCOUNT.
- The final fee and the discount are amounts in EUR. Each amount is exact to the cent.
- If IV_DAYS is not greater than 30, the discount is zero.
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_HIRE_FEE.
7. Acceptance
- The class is active and has no syntax error.
- Write your own ABAP Unit tests for the class.