Exercise 1: Computing the Total for a Single $120.00 Item — Possible Solution ==================================================================== CART: 1 item, quantity 1, unit price $120.00 SUBPROBLEM 1 - CalculateSubtotal ------------------------------ subtotal = 1 * 120.00 = 120.00 SUBPROBLEM 2 - ApplyDiscountTier ------------------------------ subtotal (120.00) >= 100, so rate = 0.10 (the 10% tier) discounted_subtotal = 120.00 * (1 - 0.10) = 120.00 * 0.90 = 108.00 SUBPROBLEM 3 - CalculateShipping ------------------------------ discounted_subtotal (108.00) >= 75, so shipping = 0 (free shipping) SUBPROBLEM 4 - CalculateTax ------------------------------ tax = 108.00 * 0.08 = 8.64 SUBPROBLEM 5 - ComputeCartTotal (sum) ------------------------------ final_total = discounted_subtotal + shipping + tax = 108.00 + 0 + 8.64 = 116.64 FINAL ANSWER: $116.64 WHY THIS WORKS AS AN ANSWER ------------------------------ Each of the five subproblems is computed in the exact order this chapter's own ComputeCartTotal composition specifies, with each step's result shown explicitly and fed into the next, mirroring exactly how this chapter's own worked example presented its result - not just stating the final number, but showing each subproblem's own contribution along the way.