Files
abap-llm/tasks_gen/eval/G0150/spec.md

2.3 KiB

1. Goal

Calculate the consultation fee of a visit at a veterinary clinic. A clinic program calls the calculation before it prints the invoice. The program needs the fee and one reason code for each visit.

2. Open questions

None.

3. Context

  • The interface {{P}}IF_VET_FEE exists in package $TMP. It is active. Read the interface. It contains the types, the constants and the method signature that the calculation uses.
  • The interface is not part of this task.

4. Contract

  • Create the class {{P}}VET_FEE_CALC in package $TMP.
  • The class is public, final, and has a public constructor without parameters.
  • The class implements {{P}}IF_VET_FEE.
  • Do not add other public methods.

5. Business rules

The rules run in this sequence. Rules 1 to 3 prepare and check the input. Rules 4 to 8 calculate the fee.

  1. Remove all spaces from the species. Convert all letters to upper case.
  2. The species must be DOG, CAT, RABBIT, BIRD or REPTILE. If not, the calculation returns the reason SPECIES and a fee of 0.
  3. The weight must be above 0 kg and at most 200 kg. If not, the calculation returns the reason WEIGHT and a fee of 0.
  4. The base fee depends on the species: DOG 45.00, CAT 35.00, RABBIT 25.00, BIRD 18.00, REPTILE 30.00.
  5. The medication fee is 2.00 for each started kilogram of weight above 5 kg. Examples: 5.000 kg gives 0.00, 5.001 kg gives 2.00, 7.000 kg gives 4.00, 7.001 kg gives 6.00.
  6. If the visit is an emergency, add half of the base fee. For a dog the surcharge is 22.50.
  7. If the animal is a registered patient of the clinic, subtract 10 percent of the base fee plus the medication fee. The emergency surcharge is not part of the discount. The base fee plus the medication fee is always a whole number of euro, so the discount has at most one decimal place.
  8. The fee is the base fee plus the medication fee plus the emergency surcharge minus the registered discount. The calculation returns the reason OK and this fee.

6. Constraints

  • Release target: 7.58.
  • 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_VET_FEE.

7. Acceptance

  • The class is active and has no syntax error.
  • The hidden tests pass.
  • Write your own ABAP Unit tests for the class.