Arguments, values, and references

F-PASS-V4-3hard

Branch routes from one base

A checkout preview loads one OrderDraft containing item prices, coupons and delivery options. It updates the subtotal, computes price statistics without reordering items, then compares routes without changing the canonical draft.

What needs to change

Repair withStop so each branch gets the base plus its own stop, and the base stays as it was.

Reproduce

  1. Use go run on the two-branch sample with its three-stop base and compare both branches with the expected stdout.

Acceptance criteria

Your review marks · Saved in this browser. Test acceptance is tracked separately.

Notes

The OrderDraft reader and both completed checkout helpers in main.go are supplied. After subtotal and price statistics, the caller compares delivery alternatives against the canonical route.

Supplied input is well-formed finite data: order id; prices followed by a nonempty odd number of integer prices, including any free items; coupons followed by zero or more integer discounts; route followed by its stops; branch name stop lines; end. Repeat whole blocks for multiple drafts. Prices and intermediate totals are exactly representable in the selected language; input validation is supplied outside this exercise.

The supplied caller retains every branch before printing, then prints the canonical route.

Sign in to open this exercise

The ticket brief is public. Sign in to access the exercise. Paid exercises require Pro.

Sign in