Skip to main content

Practice · 3 of 5

Hidden conditions in a story

CHALLENGE
Difficulty: intermediate+25 XP

A train ticket costs a **flat 400** when start and end stations are in the **same zone**; otherwise **200 per zone crossed** (absolute difference between zone numbers). Implement fee(int start, int end, int zone) where start/end are the zones of the boarding and exit stations. Careful: the parameters are already zones — do not invent extra mapping.

Back to lesson: Practice: Reading specs like the exam writes them