An algorithm is designed to calculate loyalty discounts for customers at a retail store, based on their age and number of years of membership.
customerAge ← USERINPUT
membershipYears ← USERINPUT
discountAmount ← 0.0
msgIneligible ← "Does not meet requirements"
msgTooYoung ← "Age limit not reached"
IF customerAge >= 18 AND membershipYears > 0 THEN
IF membershipYears > 5 THEN
discountAmount ← 20.0
OUTPUT discountAmount
ELSE IF membershipYears > 2 THEN
discountAmount ← 10.0
OUTPUT discountAmount
ELSE
OUTPUT msgIneligible
ENDIF
ELSE
OUTPUT msgTooYoung
ENDIF
State how many possible values the result of the comparison customerAge >= 18 could evaluate to in the algorithm shown in Figure 1.
19 exam-style questions on AQA GCSE Computer Science Boolean operations in a programming language. Each one has a worked solution and a mark scheme showing where the marks go.