51 lines
2.2 KiB
Markdown
51 lines
2.2 KiB
Markdown
# 1. Goal
|
|
A vehicle inspection station checks a vehicle before it gives a test
|
|
certificate. The check returns one reason code for each vehicle.
|
|
|
|
# 2. Open questions
|
|
None.
|
|
|
|
# 3. Context
|
|
- The interface {{P}}IF_INSPECTION_CHECK exists in package $TMP. It is active.
|
|
- The interface has the type of the reason code, one constant for each reason
|
|
code, and one method that checks a vehicle.
|
|
- Read the interface. It gives the exact method name, the parameters and the
|
|
type of the return value. This specification does not repeat the signature.
|
|
|
|
# 4. Contract
|
|
- Create the class {{P}}INSPECTION_CHECKER in package $TMP.
|
|
- The class is public and final. It has a public constructor without parameters.
|
|
- The class implements {{P}}IF_INSPECTION_CHECK.
|
|
- Do not add other public methods.
|
|
|
|
# 5. Business rules
|
|
Apply the rules in this sequence. Return the reason code of the first rule that
|
|
fails.
|
|
1. Remove all spaces from the plate. Convert all letters to upper case. If the
|
|
result is empty, return the reason code for a missing plate (NO_PLATE).
|
|
2. Remove all spaces from the make. Convert all letters to upper case. If the
|
|
result is empty, return the reason code for a missing make (NO_MAKE).
|
|
3. If the first registration date is initial or after the check date, return the
|
|
reason code for a bad registration date (REG_DATE).
|
|
4. Calculate the age of the vehicle. The age is the number of full years between
|
|
the first registration date and the check date. If the age is 30 years or
|
|
more, return the reason code for an old vehicle (TOO_OLD).
|
|
5. If the mileage is less than zero, return the reason code for a bad mileage
|
|
(MILEAGE).
|
|
6. If the brake performance is less than 50 percent, return the reason code for
|
|
weak brakes (BRAKES).
|
|
7. If the exhaust value is more than 1000 ppm, return the reason code for a bad
|
|
exhaust value (EXHAUST).
|
|
8. Else return the reason code for a passed check (OK).
|
|
|
|
# 6. Constraints
|
|
- Release target: ABAP Platform 2025 (SAP_BASIS 816).
|
|
- 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_INSPECTION_CHECK.
|
|
|
|
# 7. Acceptance
|
|
- The class is active and has no syntax error.
|
|
- The hidden tests pass.
|
|
- Write your own ABAP Unit tests for the class.
|