Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014aUaQeLnwbb1zTpN7kHeat
1.7 KiB
1.7 KiB
1. Goal
Calculate the monthly fee for a member of a coworking space. A billing program calls the calculation before it creates an invoice. The program needs one fee for each member.
2. Open questions
None.
3. Context
- Package $TMP is available.
- The class {{P}}COWORK_FEE does not exist yet.
- The billing program uses the public method of the class.
4. Contract
- Create the class {{P}}COWORK_FEE in package $TMP.
- The class is public and final.
- The class has a public constructor without parameters.
- The class has one public method: CALCULATE_FEE IMPORTING iv_desk TYPE ty_desk iv_months TYPE i iv_student TYPE abap_bool iv_under_25 TYPE abap_bool RETURNING VALUE(rv_fee) TYPE ty_amount.
- Define the types ty_desk (C LENGTH 3) and ty_amount (TYPE i) in the public section.
- Do not add other public methods.
5. Business rules
- The desk type is HOT, DED, or PRI. The base monthly fee is 200 for HOT, 350 for DED, and 600 for PRI. If the desk type is not in this list, return 0.
- The number of months must be at least 1. If iv_months is less than 1, return 0.
- The fee is the monthly fee multiplied by the number of months.
- If the member is a student, the monthly fee is 160 for HOT, 280 for DED, and 480 for PRI.
- If the member is under 25, the monthly fee is 150 for HOT, 260 for DED, and 450 for PRI.
6. Constraints
- Release target: SAP_BASIS 816.
- Coding standards: Clean ABAP. Method length below 40 statements. No global variables. No comment that restates the code.
- Out of scope: no other objects.
7. Acceptance
- The class is active and has no syntax error.
- The class passes the ATC checks with no priority 1 or 2 findings.
- Write your own ABAP Unit tests for the class.