January 2018
Beginner to intermediate
312 pages
7h 22m
English
For our first requirements change, let’s look at how to calculate shipping and delivery charges. Let’s say that the company wants to charge customers for shipping using a special calculation. How can we integrate this new requirement?
First we’ll need a function to calculate the shipping cost. Let’s say that this company is based in California, so shipping to local states is one price (say $5), shipping to remote states is another price (say $10), and shipping to another country is yet another price ($20).
Here’s a first pass at implementing this calculation:
| | /// Calculate the shipping cost for an order |
| | let calculateShippingCost validatedOrder = |
| | let shippingAddress = validatedOrder.ShippingAddress ... |
Read now
Unlock full access