Printable worksheet ยท 2 of 4
Give each component a clear responsibility - Paper 2
Read the information, then answer the questions. An adult may read the instructions aloud. Show your working where asked.
Read before answering
Design a score workflow. Input: correct=3, pointsEach=5, both non-negative integers. validate checks types/ranges; calculate(correct,pointsEach) RETURNS their product without side effects; save(accountId,result) owns authorised persistence and may fail; display reports the actual outcome. No real accounts or files are used here.
Worksheet preview
- What must calculate(3,5) return, and what must it not change?
- Describe the component order and the branch when validation fails.
- If calculation succeeds but save fails, may the interface say the whole workflow succeeded?
This exercise is included in the free preview. Register free to complete it and download the preview PDFs. No payment is required.
Already registered? Sign in