Files

6 lines
1.8 KiB
Markdown

Hello, please create the class {{P}}CREDIT_CHECKER in package $TMP. The class is public and final. It has a public constructor without parameters. It implements the interface {{P}}IF_CREDIT_CHECK. Do not add other public methods. The interface {{P}}IF_CREDIT_CHECK exists in package $TMP. It is active. It declares the type of the reason, the type of a money amount, the constants of the reason codes, and one method. The method name, the parameter names, and the parameter types are not in this document. Read the interface in the system. The reason constants have the names OK, AGE, INCOME, OPEN_PLAN, and LIMIT. There are no open questions.
The check receives the age of the customer in years, the net monthly income of the customer, the number of open instalment plans of the customer, and the amount of the new order. Apply the rules in this sequence. Return the reason of the first rule that fails. If the age is less than 18, return AGE. If the net monthly income is zero or less, return INCOME. If the number of open instalment plans is 2 or more, return OPEN_PLAN. Calculate the credit limit. Start with three times the net monthly income. Subtract 500 for each open instalment plan. If the age is less than 21, halve the limit and round the result down to whole euros. For example, 3750.75 becomes 3750.00. If the amount of the new order is more than the credit limit, return LIMIT. Else return OK.
The release target is SAP_BASIS 8.16 (ABAP Platform 2025). Use Clean ABAP coding standards. Keep the method length below 40 statements. Do not use global variables. Do not write comments that restate the code. Do not change the interface {{P}}IF_CREDIT_CHECK. The class must be active and have no syntax error. The hidden tests must pass. Write your own ABAP Unit tests for the class.