At a school race in Leeds, what stops a spectator from logging the winning time?
You’re helping run a school race in Leeds. The results screen has a box for the runner’s time, but a spectator can reach it too. What must the program check before it saves a result?
Start by naming what goes in and what comes out. The program gets the selected runner’s ID, the time as text and a trusted sign-in result. It uses those inputs to either save the time and show a confirmation, or show a rejection message without saving.
Look at the first two rows. A signed-in official can save one second or three thousand six hundred seconds. The text must contain digits only, and both limits count. One more second is rejected. A valid time from someone without an official sign-in is rejected too. These are your acceptance criteria.
A signed-in official types seventy-five point five seconds. That’s well below the maximum, but look again at the rule about whole seconds. What should the program do? Pick the outcome that follows the brief.
Split the program into smaller jobs. That’s decomposition. Check Official returns yes only when the trusted sign-in result confirms a signed-in official. Validate Time returns whole seconds if the text meets the rule, or invalid if it doesn’t. After both checks pass, Save Result records the seconds for the selected runner.
Follow the calls for runner twelve. Check Official gets the trusted sign-in result and returns yes. Validate Time changes the text four eight zero into four hundred and eighty seconds. Both checks pass, so you save that time for runner twelve. Then display a confirmation.
Now runner twelve has a signed-in official entering three thousand six hundred and one seconds. The first check passes. Follow what the validation module returns and what the program should do next. Pick the matching trace.
Start by reading the inputs. If the sign-in check fails, show a rejection message. On yes, check the time. An invalid time leads to the same message. If the time is valid, save the result, then show a confirmation. Both routes end there.
Pause and design a swim-race program. Require an official sign-in and digits only, from one to six hundred seconds inclusive. Write acceptance criteria and module contracts, then draw the paths to confirmation or rejection. Variable names alone show no decisions. Next, code it, test both limits and a failed sign-in, and fix any mismatches.
If Paper One asks you to explain how your design meets the requirements, trace the actual paths. A failed official check means reject without saving. If the official check passes but the time check fails, reject without saving again. If both pass, save the result and show a confirmation.