79 lines
3.0 KiB
Markdown
79 lines
3.0 KiB
Markdown
# 1. Goal
|
|
An airport charges a landing fee and a passenger fee for each aircraft movement.
|
|
The operations desk calls the calculation before it issues the invoice.
|
|
|
|
# 2. Open questions
|
|
None.
|
|
|
|
# 3. Context
|
|
- The class {{P}}AIRPORT_FEE is new. It is in package $TMP.
|
|
- The airport uses short codes. A weight class has one character. A noise zone
|
|
has two characters. A night flag has one character. A currency has three
|
|
characters.
|
|
- The landing fee is charged for each tonne of the maximum take-off mass.
|
|
|
|
# 4. Contract
|
|
- Create the class {{P}}AIRPORT_FEE in package $TMP.
|
|
- The class is public, final, and has a public constructor without parameters.
|
|
- Define these public types:
|
|
- TY_CLASS TYPE c LENGTH 1
|
|
- TY_ZONE TYPE c LENGTH 2
|
|
- TY_FLAG TYPE c LENGTH 1
|
|
- TY_CURR TYPE c LENGTH 3
|
|
- TY_AMOUNT TYPE p LENGTH 10 DECIMALS 2
|
|
- Define these public methods:
|
|
- LANDING_FEE
|
|
IMPORTING iv_class TYPE ty_class
|
|
iv_zone TYPE ty_zone
|
|
iv_night TYPE ty_flag
|
|
iv_currency TYPE ty_curr
|
|
iv_tonnes TYPE i
|
|
RETURNING VALUE(rv_fee) TYPE ty_amount
|
|
- PASSENGER_FEE
|
|
IMPORTING iv_zone TYPE ty_zone
|
|
iv_currency TYPE ty_curr
|
|
iv_passengers TYPE i
|
|
RETURNING VALUE(rv_fee) TYPE ty_amount
|
|
- Do not add other public methods.
|
|
|
|
# 5. Business rules
|
|
|
|
## 5.1 Landing fee
|
|
Apply the rules in this sequence.
|
|
1. If iv_currency is not EUR, USD or CHF, return 0.00.
|
|
2. If iv_class is not L, M or H, return 0.00.
|
|
3. If iv_tonnes is less than 1, return 0.00.
|
|
4. The base fee for one tonne is 12.50 EUR for L, 24.50 EUR for M and 52.50 EUR
|
|
for H.
|
|
5. The noise zone gives a surcharge on the base fee for one tonne. Z1 gives
|
|
0 percent, Z2 gives 12.5 percent and Z3 gives 27.5 percent. Any other zone
|
|
gives 0 percent.
|
|
6. If iv_night is N, add 7.50 EUR to the fee for one tonne.
|
|
7. Convert the fee for one tonne with the currency rate and round it to
|
|
2 decimals. EUR is 1.00, USD is 1.15 and CHF is 0.85.
|
|
8. Multiply the rounded fee for one tonne by iv_tonnes. The result is the
|
|
landing fee.
|
|
|
|
## 5.2 Passenger fee
|
|
Apply the rules in this sequence.
|
|
1. If iv_currency is not EUR, USD or CHF, return 0.00.
|
|
2. If iv_passengers is less than 1, return 0.00.
|
|
3. The fee for one passenger is 12.37 EUR.
|
|
4. The noise zone gives a surcharge for each passenger. Z1 gives 0.00 EUR, Z2
|
|
gives 1.45 EUR and Z3 gives 2.90 EUR. Any other zone gives 0.00 EUR.
|
|
5. Convert the fee for one passenger with the currency rate and round it to
|
|
2 decimals. EUR is 1.00, USD is 1.15 and CHF is 0.85.
|
|
6. Multiply the rounded fee for one passenger by iv_passengers. The result is
|
|
the passenger fee.
|
|
|
|
# 6. Constraints
|
|
- Release target: SAP_BASIS 8.16 (ABAP Platform 2025).
|
|
- Coding standards: Clean ABAP. Method length below 40 statements. No global
|
|
variables.
|
|
- Out of scope: no database access, no ALV list, no CDS view.
|
|
|
|
# 7. Acceptance
|
|
- The class is active and has no syntax error.
|
|
- The hidden tests pass.
|
|
- Write your own ABAP Unit tests for the class.
|