Skip to content

Lesson 9 Practice — Shipping Cost Utility ​

Create:

text
ZCL_SHIPPING_CALCULATOR_###
ZCL_ABAP_L09_PRACTICE_###

Constants ​

Define rates for at least two shipping tiers.

Static methods ​

Create:

text
CALCULATE_STANDARD
CALCULATE_EXPRESS

Both import a weight and return decfloat34.

Optional class data:

text
calculations_done

If used, make it externally read-only and explain why mutable class state should remain minimal.

Runner ​

Call methods with =>; do not instantiate the calculator.

Use at least one FINAL(...) local input.

Questions ​

  1. Why is => used instead of ->?
  2. Why is a shipping rate a good constant?
  3. What is shared about CLASS-DATA?
  4. What is the difference between CONSTANTS and FINAL(...)?
  5. When would an instance calculator be preferable to static methods?