Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 1. calculateShippingCost
- global totalDistance
- global shippingCost
- output (Enter the distance in miles:)
- input (totalDistance)
- call validDistance
- call calcVariableCosts
- set shippingCost
- shippingCost = shippingCost + 50
- proc validDistance
- if (totalDistance < 0) then
- output (ERROR: The distance should be a positive value)
- else
- (totalDistance > 0)
- endif
- endproc
- proc calcVariableCosts
- if (totalDistance <= 100)
- then
- totalDistance * 5.5 = shippingCost
- else
- if totalDistance > 100 & totalDistance <= 500
- then
- totalDistance – 100 = n1
- 100*5.5 = n2
- n1*4 = n3
- n2+n3 = shippingCost
- else
- if totalDistance > 500
- then
- totalDistance – 100 = n1
- n1 – 400 = n2
- 100 * 5.5 = n3
- 400 * 4.0 = n4
- n2 * 2.5 = n5
- n3 + n4 + n5 = shippingCost
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement