Class Calculator
java.lang.Object
control.Calculator
The Calculator class provides methods for calculating shipping costs based on packet dimensions and weight.
Includes a method for calculating shipping costs using the loaded shipping rules and converting
the packet dimensions to metric units if needed using the current setting from SettingsManager and converting
method provided by MeasurementSystem. Also uses the ShippingRuleLoader to load the shipping rules
from an external JSON file.
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic doublecalcShippingCosts(Packet pack) Calculates the shipping costs based on the dimensions and weight of the given packet.
-
Constructor Details
-
Calculator
public Calculator()
-
-
Method Details
-
calcShippingCosts
Calculates the shipping costs based on the dimensions and weight of the given packet. Uses the shipping rules loaded from an external JSON file.- Parameters:
pack- the packet for which the shipping costs are to be calculated- Returns:
- the calculated shipping costs
- Throws:
ShippingRuleException- if the shipping rules cannot be loaded
-