50 lines
2.0 KiB
Markdown
50 lines
2.0 KiB
Markdown
# 1. Goal
|
|
Calculate the fee of hiring a marquee tent for an event. A booking program
|
|
calls the calculation before it confirms a booking. The program needs the
|
|
gross price in euro.
|
|
|
|
# 2. Open questions
|
|
None.
|
|
|
|
# 3. Context
|
|
- Interface {{P}}IF_TENT_HIRE exists in package $TMP. It is active.
|
|
- The interface has the type TY_AMOUNT (P LENGTH 15 DECIMALS 2), the constant
|
|
structures C_RATE_S, C_RATE_M and C_RATE_L, the constants C_VAT,
|
|
C_DISCOUNT and C_LONG_RENTAL_DAYS, and one method:
|
|
CALCULATE_FEE IMPORTING iv_tent_size TYPE string
|
|
iv_days TYPE i
|
|
RETURNING VALUE(rv_fee) TYPE ty_amount.
|
|
- Each rate structure has the components RATE_DAY and SETUP_FEE.
|
|
C_RATE_S belongs to tent size S, C_RATE_M to tent size M and C_RATE_L to
|
|
tent size L.
|
|
- C_VAT is the value added tax rate. C_DISCOUNT is the discount rate.
|
|
C_LONG_RENTAL_DAYS is the number of days from which the discount applies.
|
|
|
|
# 4. Contract
|
|
- Create the class {{P}}TENT_HIRE_FEE in package $TMP.
|
|
- The class is public, final, and has a public constructor without parameters.
|
|
- The class implements {{P}}IF_TENT_HIRE.
|
|
- Do not add other public methods.
|
|
|
|
# 5. Business rules
|
|
Apply the rules in this sequence.
|
|
1. Read the daily rate and the setup fee for the tent size. Tent size S uses
|
|
C_RATE_S, tent size M uses C_RATE_M and tent size L uses C_RATE_L. If the
|
|
tent size is not S, M or L, return 0.
|
|
2. The net price is the number of days multiplied by the daily rate plus the
|
|
setup fee.
|
|
3. If the number of days is C_LONG_RENTAL_DAYS or more, reduce the net price by
|
|
C_DISCOUNT.
|
|
4. Add value added tax of C_VAT to the net price. The result is the gross price
|
|
in euro. The gross price must have two decimal places.
|
|
|
|
# 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_TENT_HIRE.
|
|
|
|
# 7. Acceptance
|
|
- The class is active and has no syntax error.
|
|
- Write your own ABAP Unit tests for the class.
|