The price to transport a shipment depends on 2 things i) the distance from origin to destination and ii) the weight of the shipment
For example, If the transportation distance is less than 100 kms, the cost is 10$ If the transportation distance is between 100 and 200 kms, the cost is 20$ If the transportation distance is greater than 200 kms, the cost is 30$
If the shipment weight is less than 10 kgs, the cost is 10$ If the shipment weight is between 10 and 20 kgs, the cost is 20$ If the shipment weight is greater than 20 kgs, the cost is 30$
So, to transport a 50 kg shipment for 500 kms, the total cost is 60$.
Now, the shipment will have a getTotalCost() method, which will calculate the total cost, based on the above rules. It can be done with simple if/else checks, but ofcourse that is the worst way of doing.
But it's most likely overkill, and easy to refactor to should it become valuable.
The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus