Practice
Flowchart: Validated Age Entry
HARDFlowcharts
Answer with a flowchart — draw it with the Cambridge symbols. Checking turns it into pseudocode and runs the tests below.
Draw a flowchart that keeps asking for an age until it is between 0 and 120 inclusive.
Each time an invalid age is entered, output Invalid. When a valid age is entered, output Accepted followed by the age.
Input: one or more integers.
Output: Invalid for each rejected age, then Accepted <age>.
Sample Test Cases
Test 1: Valid first time
Inputs: 25
Expected: Accepted 25
Test 2: Two bad entries
Inputs: -3, 130, 40
Expected: Invalid
Invalid
Accepted 40